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 encoding-confidences to use when guessing #84503
*duplicateIssue identified as a duplicate of another issue(s)feature-requestRequest for new features or functionalityinfo-neededIssue requires more information from poster
Since there were so many encodings issues,I plan to upgrade the code guessing workflow to V2.
First, jschardet will be upgraded and multiple results will be returned. For example, [{encoding: 'UTF-8', confidence: 0.95}, {encoding: 'GBK', confidence: 0.95}].
Then, we will support the configuration of multiple sets of coding confidence in the settings.files.encodingInitConfidences。 [{encoding:'utf-8',confidence:0.01},{encoding:'GBK',confidence:0.03}]。
Finally,add the two together to get the final result, because GBK has the highest confidence, so the file is recognized as GBK [{encoding:'utf-8',confidence:0.06},{encoding:'GBK',confidence:0.08}]。
Reacted by irudoy, Gabriel Nützi, Viacheslav Gordeiko, William Théroux, Jan Brchaň, DailyShana, Kt Zhang, 酷酷的哀殿, Steffen Brüheim, Ninzero Xu and 12 more
I am not sure VSCode would move off jschardet to another module, seems rather risky. I would suggest you try to become a contributor on jschardet to improve it if possible.
Since jschardet can't provide the expected results.
We can provide node-chardet as an optional option. If there are enough people to choose the new switch in the future, we can remove the jschardet in the future
I like the mode provided by node-chardet. Just a friendly reminder that please always use GB18030 to replace GB2312 or GBK regardless of the confidence value.
Reasons:
New characters in a file encoded in GB18030 will lose if the file is edited in lower encoding.
New characters cannot be displayed normally with lower encoding (nothing will lose if it is just opened, but if it is saved with lower encoding, information will be destroyed)
A file encoded in GB2312 or GBK can be decoded as GB18030. Even though new characters would lose if it is decoded by lower encoding again, nothing is wrong at least.
All in all, the safest way is always using GB18030 instead of GB2312 or GBK.
Here is a file encoded by GB18030 for your test. test_GB18030.txt
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.
This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
I am not sure VSCode would move off jschardet to another module, seems rather risky. I would suggest you try to become a contributor on jschardet to improve it if possible.
When we use the new version of jschardet , we are also taking risks.
So, why not try the node-chardet?
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.
*duplicateIssue identified as a duplicate of another issue(s)feature-requestRequest for new features or functionalityinfo-neededIssue requires more information from poster
Activity
vscodebot commentedon Nov 11, 2019
(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
bpasero commentedon Nov 12, 2019
酷酷的哀殿 (@sunbohong) are you planning to contribute to JSChardet?
sunbohong commentedon Nov 12, 2019
I found that https://github.com/runk/node-chardet can meet my requirements.
bpasero commentedon Nov 12, 2019
I am not sure VSCode would move off
jschardetto another module, seems rather risky. I would suggest you try to become a contributor onjschardetto improve it if possible.sunbohong commentedon Nov 12, 2019
I tried to add some logs to
jschardet, but it failed the following test. aadsm/jschardet#48node-chardetworks well with this test.The best is
utf-8jschardetcann't pass this test.windows-1252 confidence 0.95UTF-8 confidence = 0.505sunbohong commentedon Nov 19, 2019
Benjamin Pasero (@bpasero)
Since jschardet can't provide the expected results.
We can provide node-chardet as an optional option. If there are enough people to choose the new switch in the future, we can remove the jschardet in the future
byyxx128 commentedon Nov 19, 2019
I like the mode provided by node-chardet. Just a friendly reminder that please always use
GB18030to replaceGB2312orGBKregardless of the confidence value.Reasons:
GB18030will lose if the file is edited in lower encoding.GB2312orGBKcan be decoded asGB18030. Even though new characters would lose if it is decoded by lower encoding again, nothing is wrong at least.All in all, the safest way is always using
GB18030instead ofGB2312orGBK.Here is a file encoded by GB18030 for your test.
test_GB18030.txt
vscodebot commentedon Jan 15, 2020
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
vscodebot commentedon Mar 6, 2020
This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.
Happy Coding
vscodebot commentedon Mar 6, 2020
This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.
Happy Coding
vscodebot commentedon Mar 6, 2020
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
bpasero commentedon Nov 4, 2020
酷酷的哀殿 (@sunbohong) please merge this with #36951, I feel the 2 suggestions are very similar.
sunbohong commentedon Nov 4, 2020
When we use the new version of
jschardet, we are also taking risks.So, why not try the
node-chardet?bpasero commentedon Nov 4, 2020
Some requirements to go with another library such as
node-chardetimho are:jschardetwork innode-chardet(this would give some confidence)bpasero commentedon Nov 10, 2020
/duplicate #36951
vscode-triage-bot commentedon Nov 10, 2020
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.
Happy Coding!