Subject: [Boost-bugs] [Boost C++ Libraries] #9968: [filesystem] Streams don't handle unicode file name on Windows
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-04-30 20:56:08
#9968: [filesystem] Streams don't handle unicode file name on Windows
------------------------------+------------------------
Reporter: mike@⦠| Owner: bemandawes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
Version: Boost 1.55.0 | Severity: Problem
Keywords: mingw |
------------------------------+------------------------
I want to read / write a file with a unicode file name using boost
filesystem, boost locale on Windows (mingw).
This is my code:
#include <boost/locale.hpp>
#define BOOST_NO_CXX11_SCOPED_ENUMS
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
namespace fs = boost::filesystem;
#include <string>
#include <iostream>
int main() {
std::locale::global(boost::locale::generator().generate(""));
fs::path::imbue(std::locale());
fs::path file("äöü.txt");
if (!fs::exists(file)) {
std::cout << "File does not exist" << std::endl;
}
fs::ofstream(file, std::ios_base::app) << "Test" << std::endl;
}
The fs::exists really checks for a file with the name äöü.txt. But the
written file has the name äöü.txt.
Reading gives the same problem. Using fs::wofstream doesn't help either,
since this just handles wide input.
So it seems the behaviour of fs::ofstream is off.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9968> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC