You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow to configure a list of encodings to use when guessing #36951
Yes, I'm totally agree because It is so weak for auto guess.
Add a candidate may be better!
For me, of may be Many Chinese Coder, only UTF-8 and GB18030 are most commonly meet, but auto-guess give me the Windows 1532??? I think is is easier to detect in users' encoding candidates.
Reacted by oxalica, Yang Hanlin, x7890, Leojc, mozhuanzuojing, ettingshausen, charle-y and wwcMonkey
I agree. In my environment we have files in two encodings - UTF-8 and Windows1251 (most popular text file encoding in Russia), so I need to use encoding detection. However, it sometimes detects windows1251-encoded files as "maccyrillic" or "Windows1252" or some other encoding that I've never seen in my life :D
Definitely need a setting like
files.detectEncodings=["utf8","windows1251]
So instead of just "true", you can specify which encodings you want it to detect from. As far as I know, encoding detection works based on probabilities (you can't 100% say which files is which encoding, so the software has to pick the most probable answer), so I think it is possible to implement - just filter out the list of possible encoding to those user selected.
Reacted by irudoy, Vlad K, Daniel Brchan, turboon, Sylwester Zarębski, Arkadii Berezkin, Jan Brchaň, Scarboroid, Sergey Matyushkov, onirix and 6 more
I don't know whether the right place to point out was here or in the pull request, but I have found a particular situation in which the encoding detection is not working properly. #208550 (comment)
Activity
fseasy commentedon Oct 27, 2017
Yes, I'm totally agree because It is so weak for auto guess.
Add a candidate may be better!
For me, of may be Many Chinese Coder, only
UTF-8andGB18030are most commonly meet, but auto-guess give me theWindows 1532??? I think is is easier to detect in users' encoding candidates.phobos2077 commentedon Nov 15, 2017
I agree. In my environment we have files in two encodings - UTF-8 and Windows1251 (most popular text file encoding in Russia), so I need to use encoding detection. However, it sometimes detects windows1251-encoded files as "maccyrillic" or "Windows1252" or some other encoding that I've never seen in my life :D
Definitely need a setting like
files.detectEncodings=["utf8","windows1251]So instead of just "true", you can specify which encodings you want it to detect from. As far as I know, encoding detection works based on probabilities (you can't 100% say which files is which encoding, so the software has to pick the most probable answer), so I think it is possible to implement - just filter out the list of possible encoding to those user selected.
[-]Request feature in terms of encoding detection[/-][+]Allow to configure a list of encodings to force[/+]96 remaining items
bpasero commentedon Jun 5, 2024
Thanks to #208550, a new setting
files.candidateGuessEncodingsallows to specify which encodings are allowed to be guessed based on astring[]list. The option directly maps to thedetectEncodingsoption injschardet: https://github.com/aadsm/jschardet?tab=readme-ov-file#optionsThis will be available in our insiders channel on Friday after we have released stable.
peminator commentedon Jun 5, 2024
would love to try, please remind us in this thread to try after published or also after available to public.
bpasero commentedon Jun 6, 2024
This is now released in our insiders channel. You can give our preview releases a try from: https://code.visualstudio.com/insiders/
formigoni commentedon Jun 6, 2024
I have tried the implementation on Insiders versions!! It works like a charm!! Thanks Benjamin Pasero (@bpasero) thanks yutotnh (@yutotnh) thanks António Afonso (@aadsm) !!
Here is how I have configured:
alexr00 commentedon Jun 25, 2024
Benjamin Pasero (@bpasero) do you want additional verification on this?
bpasero commentedon Jun 25, 2024
I think its fine given #36951 (comment)
formigoni commentedon Jul 2, 2024
I don't know whether the right place to point out was here or in the pull request, but I have found a particular situation in which the encoding detection is not working properly.
#208550 (comment)