Problem with non-english symbols in file path

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with non-english symbols in file path

Vladimir
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:
compiler.getFileManager().getFile(file);
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.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

Nikola Smiljanic
What platform are you on? Clang doesn't handle unicode filepaths correctly on windows. http://llvm.org/bugs/show_bug.cgi?id=10348


On Thu, Jan 30, 2014 at 7:06 PM, Vladimir <[hidden email]> wrote:
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:
compiler.getFileManager().getFile(file);
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.



--
View this message in context: http://clang-developers.42468.n3.nabble.com/Problem-with-non-english-symbols-in-file-path-tp4037506.html
Sent from the Clang Developers mailing list archive at Nabble.com.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

Vladimir
Thanks to your reply, yes i'm using Windows.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

Rafael Espíndola
On 30 January 2014 07:32, Vladimir <[hidden email]> wrote:
> 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.

Cheers,
Rafael
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

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

30.01.2014, 22:31, "Rafael Espíndola" <[hidden email]>:

> On 30 January 2014 07:32, Vladimir <[hidden email]> wrote:
>
>>  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.
>
> Cheers,
> Rafael

--
С уважением, Владимир Пляшкун.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

Nikola Smiljanic
In reply to this post by Rafael Espíndola
Rafael, does that mean that the bug I referenced should be closed?


On Fri, Jan 31, 2014 at 3:31 AM, Rafael Espíndola <[hidden email]> wrote:
On 30 January 2014 07:32, Vladimir <[hidden email]> wrote:
> 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.

Cheers,
Rafael
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

Rafael Espíndola
On 30 January 2014 17:01, Nikola Smiljanic <[hidden email]> wrote:
> 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.

Cheers,
Rafael
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

Nikola Smiljanic
I'll try the examples from the bug report and see. Thanks.


On Fri, Jan 31, 2014 at 9:30 AM, Rafael Espíndola <[hidden email]> wrote:
On 30 January 2014 17:01, Nikola Smiljanic <[hidden email]> wrote:
> 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.

Cheers,
Rafael


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

Nikola Smiljanic
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.


On Fri, Jan 31, 2014 at 9:32 AM, Nikola Smiljanic <[hidden email]> wrote:
I'll try the examples from the bug report and see. Thanks.


On Fri, Jan 31, 2014 at 9:30 AM, Rafael Espíndola <[hidden email]> wrote:
On 30 January 2014 17:01, Nikola Smiljanic <[hidden email]> wrote:
> 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.

Cheers,
Rafael



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

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

Re: Problem with non-english symbols in file path

Nikola Smiljanic
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?


On Fri, Jan 31, 2014 at 4:55 PM, Vladimir <[hidden email]> wrote:
hmm, i dont set any locales in my code. I have a wide string like this
wstring ws = L"C:\\Users\\Владимир\\Documents\\Visual Studio
2013\\Projects\\acm\\acm\\Source.cpp"
then i converted it to simple string(using boost) and pass it to clang. And
it works for me.




--
View this message in context: http://clang-developers.42468.n3.nabble.com/Problem-with-non-english-symbols-in-file-path-tp4037506p4037563.html
Sent from the Clang Developers mailing list archive at Nabble.com.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with non-english symbols in file path

Vladimir
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.