-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unreadable non-UTF-8 output on localized MSVC #35785
Comments
I’m surprised we try to interpret any output in Windows as UTF-8 as opposed to UTF-16, like we should. |
I suspect that the MSVC compiler's raw output is encoded as Windows-1252 or Windows-1250 (for German) depending on the current console code page and not as UTF-16. @Boddlnagg |
No, neither in |
Is it just MSVC which is localized, or is your system codepage itself different? If we know that a certain program's output is the system codepage we could use |
@retep998 I am using a German localized Windows. How can I find out the system codepage? The default CP for console windows is "850 (OEM - Multilingual Lateinisch I)". |
@Boddlnagg You can call |
@retep998 That returns codepage numbers 1252 for |
@Boddlnagg In which case the output from the linker appears to be |
I ran into this problem as well (also on a German Windows 10). As a workaround it helps if you go to in Win 10 to Settings -> Region and Language -> Language and add English as a language and make it default ( you may have to log out and back in again). After that, programs like link.exe should output using a locale that works with rust as it is right now. It would still be great if this could be fixed in rust :) |
Just saw another instance of this in Rust-SDL2/rust-sdl2#783, except with GBK/CP936/GB2312 (a common encoding in China), where |
…r=alexcrichton MSVC link output improve Resolves rust-lang#35785. However i haven't come up with a idea to add test case for this :( r? @retep998
…r=alexcrichton MSVC link output improve Resolves rust-lang#35785. However i haven't come up with a idea to add test case for this :( r? @retep998
…r=alexcrichton MSVC link output improve Resolves rust-lang#35785. However i haven't come up with a idea to add test case for this :( r? @retep998
Using nightly 2019-07-04, we can confirm that this issue is fixed. (I'm using Chinese version of Visual Studio). |
For me, it still does not work even with nightly build (1.38 x86_64-pc-windows-msvc, Russian version of VS). I try to compile a Hello world project in Intellij Idea but always get the exception:
|
@duester Could you execute |
|
@duester
And see whether the output is English? If the output's still not in English, would you mind open "Visual Studio Installer" from start menu, choose "Modify" for the corresponding Visual Studio edition, and in the Language packs tab, install the English language pack. And try the instructions above again? |
@crlf0710, thanks! The hint about installing the English language pack has made the previous error disappear. But now I have another message while running in Idea:
I haven't changed the path to the std library, it's looks like |
Yes, this is the same error as before, it's because you didn't install windows sdk. Choose the newest one in the visual studio installer too. |
@crlf0710, thank you again. Now it's compiling and running. I'm happy ;) |
Please feel free to point out places where Rust tells you to install Visual Studio but does not tell you to install the Windows SDK, so that we can fix those places. It might still be worth implementing the text encoding version of the fix for people who don't have the English language pack, though I really wish we could just get unicode output out of VS without having to specify a language. |
@retep998, sorry, seems I was a bit inattentive. Now I double-checked: after starting rustup-init.exe the screen info says, I should assure that I have Windows SDK installed. So my fault, nothing to fix there :) Thanks. |
Disable localization for all linkers We previously disabled non-English output from `link.exe` due to encoding issues (rust-lang#35785). In rust-lang#70740 it was pointed out that it also prevents correct inspection of the linker output, which we have to do occasionally. So this PR disables localization for all linkers.
This is not a fix anymore. |
refer to rust-lang/cc-rs#552 |
@lygstate: Please make sure you have installed Visual Studio English Language Pack side by side with your favorite language pack for UI for this to work. |
I'm not sure this problem is really fixed. The PR that closed this kinda works around the issue because English is usually ASCII which is the same in UTF-8. However, as noted above, this relies on the Visual Studio English language pack being installed which it isn't always. And that there's no non-ascii output (e.g. file paths, etc). The suggestion to use |
…kingjubilee Fix Unreadable non-UTF-8 output on localized MSVC Fixes rust-lang#35785 by converting non UTF-8 linker output to Unicode using the OEM code page. Before: ```text = note: Non-UTF-8 output: LINK : fatal error LNK1181: cannot open input file \'m\x84rchenhaft.obj\'\r\n ``` After: ```text = note: LINK : fatal error LNK1181: cannot open input file 'märchenhaft.obj' ``` The difference is more dramatic if using a non-ascii language pack for Windows.
A localized (e.g. German) MSVC can produce non-UTF-8 output, which can become almost unreadable in the way it's currently forwarded to the user.
This can be seen in an (otherwise unrelated) issue comment: rust-lang/cc-rs#87 (comment)
Note especially this line:
That output might be a lot longer for multiple LNK errors (one line per error, but the lines are not properly separated in the output, because they are converted to
\r\n
) and become really hard to read.If possible, the output should be converted to Unicode in this case.
(previously reported as rust-lang/cargo#3012)
NOTE from @crlf0710: Please install Visual Studio English Language Pack side by side with your favorite language pack for UI
The text was updated successfully, but these errors were encountered: