-
Notifications
You must be signed in to change notification settings - Fork 675
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
Chinese messages appear garbled in debug console #1775
Comments
@isidorn: This is a VS Code issue: microsoft/vscode#3550. |
@DFVSQY what is your If it isn't |
@gregg-miskelly It seems like that the console depends on system encoding, if i change console.outputencoding to utf8, debug console is ok but the output window is still messy code, the default encoding is System.Text.OSEncoding,like below: |
@DFVSQY Thanks. In this case, I think there are multiple bugs but with the same root cause -- non-UTF8 characters written to tools that expect UTF8 because on Windows there aren't great conversions for specifying output encoding. I will reopen this issue to track seeing if there is anything in the debugger that we can do to try and convince the implementation of Console.OutputEncoding to default to UTF-8. For the output window, by chance does it work if you add |
Debugger implementation notes: I believe this is where CoreFX works out the default console output page: https://github.com/dotnet/corefx/blob/7ce0acee7eaadc2f3f9776a76c166b29724c8acb/src/System.Console/src/System/ConsolePal.Windows.cs#L104 So we may be able to solve this by calling |
@gregg-miskelly thanks for reopening. The issue in vscode which @DustinCampbell pointed to is task specifc and is related to code pages and how windows determines printable characters in the terminal. This is however not exactly the same as this issue - unprintable characters in the output and debug console since those characters are coming directly from your extension. |
@gregg-miskelly where i should put the /consoleloggerparameters:Encoding=UTF-8 in ? please give me an example, thank you. |
@isidorn: The non-debug output example above is simply the VS Code Output pane running the build task. C# for VS Code doesn't control that. |
@DustinCampbell yes the output is a dupilcate of the issue you linked. Thanks. |
@DFVSQY try setting |
@gregg-miskelly i have a try for that parameter, but there is no difference in output window, it's still messy code. |
@DFVSQY Thanks for trying. One last idea: {
"version": "0.1.0",
"tasks": [
{
"taskName": "build",
"command": "cmd",
"suppressTaskName": true,
"args": [
"/c chcp 65001 >nul && dotnet build ${workspaceRoot}/files.csproj"
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
} |
@gregg-miskelly i have a try for last idea, now it's ok, like below: |
Excellent. @dbaeumer: there might be a pretty trivial fix for microsoft/vscode#3550 by calling |
@gregg-miskelly thanks. With the support of running tasks in the terminal this is not needed anymore since the terminal itself already allows to specify encodings. |
@dbaeumer @gregg-miskelly indeed everything is fine within the new terminal runner. HOWEVER, this debug console UTF-8 output issue itself has not been resolved... looking for a fix... THANK YOU |
@bayesrule I will see if we can fix this in our next release. In the mean time, use the work around at the top of this issue. |
This should be fixed when we moving test to be a task. cc @TheRealPiotrP |
@Svetomech run your tests using task version 2.0.0. Then they execute in a terminal for which either the correct code page is already set or you can set it using chcp. |
@dbaeumer yes, i have a try for the new task version, The terminal output is ok but if i use the Console default encoding, the debug console output is still messy code. |
@dbaeumer how'd I do so? |
I think @dbaeumer assumed you had a custom task to run this. In this case, C# for VS Code is creating this particular output channel, so this is a bug on us to fix. |
@DustinCampbell sounds not really related to this issue. I mean, I gave running tests as an example, but in actuality all output in the Output window is encoded incorrectly. E.g. just pressing F5 results in this: |
@Svetomech : From an implementation perspective build and test are very different in C# for VS Code. The key difference is that the build task is defined in your project (in tasks.json) and can be easily converted to to tasks version 2.0. Then it will run in the Terminal as @dbaeumer. Testing with the "run/debug test" Code Lenses is not a task that is defined in your project. In that case, C# for VS Code runs specific code to handle this (not tasks) that output to a specific output channel created by the extension. |
@DustinCampbell So, as I understand, the current workaround is to always prefer |
I'm not sure whether that can be set globally. My goal in here was to point out that running tests with C# for VS Code is different and the workarounds in this issue might not help. |
@Svetomech : You can't set it globally. I have updated the title of this bug to hopefully reflect the fact that this bug is only tracking fixing output in the debug console. If there are other items that need to be fixed lets get separate issues opened. |
@DustinCampbell do we need a similar issue for dealing with build command output for unit tests? |
Yes, I think so. However, I think it is also related to @TheRealPiotrP's work on the task provider API. @TheRealPiotrP? |
@TheRealPiotrP do you want me to open another issue for unit tests? Or do you have this covered already? |
Fixed in 1.14.0-beta2 |
This bug is reproduced. Check out #3437 |
As reported by @DFVSQY here microsoft/vscode#35235
Work around:
Add the following at the start of the program:
Alternative work around:
Edit launch.json to change
"console"
to use the integrated terminal:Notes:
Please ping if you need more details.
The text was updated successfully, but these errors were encountered: