-
Notifications
You must be signed in to change notification settings - Fork 28.7k
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
A file open with auto-detected encoding. #10013
Conversation
Hi @tomoki1207, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
@tomoki1207, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
@tomoki1207 I am not sure this works the way you coded it because the encoding is a user setting and you always try to detect the encoding now. How can you still respect the user preference if the encoding is not clear? My argument is that really the only way of detecting an encoding is by looking at the BOM (Byte Order Mark) for UTF (and we do this already). Any other file encoding can only be guessed. I think one thing we could add is an action in the encoding picker to "Auto Detect" the encoding via this code and then set the encoding for the file. But always detecting the encoding for each file being opened is not right imho. |
@bpasero I understand your opinion. Do you better the following approach? Just like Atom auto detect package.
|
@tomoki1207 the approach works if every encoding can be detected with 100% certainty but I doubt that is possible for any file that does not include a BOM. What does jschardet do if the encoding is ambiguous? Nevertheless we do have a global and workspace setting for the encoding that we cannot just drop, so I see little chance of changing this to always auto detect the encoding. The only possible thing I see is to offer an action to "Guess Encoding" from the encoding picker that executes the jschardet. I believe Atom does the same. |
Closing for inactivity. |
This related to #5388.
A text file will opened with detected encoding by jschardet.