-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
File encoding specified in "files.encoding" setting is not honored #414
Comments
I'm not able to repro the problem. From your screenshot, it looks like you may be using another C++ extension for auto-completion, because our extensions doesn't provide test like that. Can you provide a sample that repros this? I created a file with GBK encoding and I didn't see a problem. |
The gbk file should contain chinese characters. |
Okay, I am able to repro the bug now. Thanks. I don't know how you got the text write(sprint ("%s..."... to appear, but I was able to get a repro via int func2(string s = "中文字符中文字符中文字符") {... |
This bug was fixed a while ago. |
Oops, it's not fixed. Looks like we don't handle GBK encoding correctly. |
It looks like "most" functionality is broken when it interacts with 2-byte GBK encoding Chinese characters. Our code assumes UTF-8 characters are being used and we never check the encoding. |
I hit this accidentally after opening header file that somehow got encoding "UTF-8 with BOM" -- IntelliSense was broken due to offsets being all off by one. |
Moving this into 1.0 milestone, as support for GB18030 encoding is a global compliance requirement. |
I also have same problem,when mouse over function same time cannot get right tip。 |
We should be handling UTF8, UTF16LE and UTF16BE properly, as these are detectable based on some header bytes within the file. There appear to be issues with file encodings that aren't detectable this way. GBK, GB2312 and GB18030 just look like UTF8 to us. Files opened within VS Code are provided to us in UTF8, with VS Code having already done the proper conversion from encodings it supports, if configured to do so. It uses 2 settings:
or:
We're not currently considering these settings when opening files directly from disk, such as when scanning header files for doc comments. We should use the encoding specified by It looks like there are similar issues in VS related to this (we share IntelliSense code with VS) that would need to be addressed as well |
Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders4 . Let us know if you see any remaining bugs with non-UTF-8 encodings. |
Note that the C/C++ Extension will now use the file encoding specified in |
@Colengms Should we open an issue to track the potential files.autoGuessEncoding? |
@sean-mcmanus That would be: #4753 |
In my workspace's settings.json
{
"files.encoding": "gbk"
}
These is still encoding problem in the auto completetion.
The text was updated successfully, but these errors were encountered: