Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's a bit annoying and lame but not really a huge deal. For example, you can just open an fstream like so:

  std::ofstream file(convertUTF8ToFStreamPath(pathname).c_str());
Where convertUTF8ToFStreamPath converts from UTF-8 to the Windows wide encoding (UTF-16?)


It gets even more fun when you have no choice but to use a poorly maintained closed-source third-party library (par for the course on Windows). If the library authors didn't use this trick themselves you can get stuck in situations where you have no way to make the library open the file without resorting to the DOS 8.3 name. And if the user disabled 8.3 names system-wide... then the only consolation is that something even more important on the system will probably break first. A sad state of affairs in 2016.


The third party library situation is indeed trickier. I've never found a library that I couldn't get to open Unicode paths eventually though. Sometimes you have to open a file handle yourself and pass it to the library.

Edit: By the way the worst handling of Unicode paths on Windows I have found is by Ruby, which is still partially broken. (last time I checked)


What is broken? Have you reported it? I've reported a related bug this week (File.truncate called CreateFileA() with a UTF-8 string). I even had a working patch but forgot to attach it. Anyway it was almost immediately fixed including various additional tests for other File class methods (which handled Unicode without any problems).





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: