Problem with non-english symbols in file path

Hello, i'm using clang and i try to parse some file (filepath passed to my
app through command line). I set locale in code, so string content looks
correct (also standart ifstream/ofstream works good), but when i pass this
string to clang:
FileEntry* is always NULL, which causes an assert (that i pass invalid file
). How i can solve this problem? I hope, that clang can support russian
symbols in filepath.

What platform are you on? Clang doesn’t handle unicode filepaths correctly on windows.

Thanks to your reply, yes i'm using Windows.

Which version of clang? Current trunk should be asking windows for a
utf-16 path and converting it to utf-8 internally. Try putting a
breakpoint in openFileForRead and see if the path looks correct.


Thanks, Rafael. My problem was in wrong encoding. After some changes i solve this.
Sorry for my possible bad english :slight_smile:

Rafael, does that mean that the bug I referenced should be closed?

I *think* it was fixed by r192091, but I have not checked that.


I’ll try the examples from the bug report and see. Thanks.

The bug is still there, I’m guessing that it works for Vladimir because he’s changing the codepage and not really using the unicode filename.

hmm, i dont set any locales in my code. I have a wide string like this
wstring ws = L"C:\\Users\\Владимир\\Documents\\Visual Studio
then i converted it to simple string(using boost) and pass it to clang. And
it works for me.

And does it work if you rename your source file to Владимир.cpp? I’m also interested to know how you invoke clang since you’re obviously doing this from the code?

yes, path "C:\\Users\\Владимир\\Documents\\Visual Studio
2013\\Projects\\acm\\acm\\Владимир.cpp" also works good. I dont call clang
process. I'm using its api from code (CompilerInstance and other classes
from examples, which parse source code and provide me AST tree). When i
wrote "pass to clang" i mean this.