Skip to content

Allow to configure a list of encoding-confidences to use when guessing #84503

Closed

Description

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}]。

Activity

  1. vscodebot commented on Nov 11, 2019

    @vscodebot

    (Experimental duplicate detection)
    Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

  2. bpasero commented on Nov 12, 2019

    @bpasero
    Contributor

    First, jschardet will be upgraded and multiple results will be returned

    酷酷的哀殿 (@sunbohong) are you planning to contribute to JSChardet?

  3. sunbohong commented on Nov 12, 2019

    @sunbohong
    ContributorAuthor

    First, jschardet will be upgraded and multiple results will be returned

    酷酷的哀殿 (@sunbohong) are you planning to contribute to JSChardet?

    I found that https://github.com/runk/node-chardet can meet my requirements.

  4. bpasero commented on Nov 12, 2019

    @bpasero
    Contributor

    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.

  5. sunbohong commented on Nov 12, 2019

    @sunbohong
    ContributorAuthor

    I tried to add some logs to jschardet, but it failed the following test. aadsm/jschardet#48

    node-chardet works well with this test.
    The best is utf-8
    image

    jschardet cann't pass this test.

    windows-1252 confidence 0.95
    image
    UTF-8 confidence = 0.505
    image

  6. sunbohong commented on Nov 19, 2019

    @sunbohong
    ContributorAuthor

    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

  7. byyxx128 commented on Nov 19, 2019

    @byyxx128

    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

  8. vscodebot commented on Jan 15, 2020

    @vscodebot

    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!

  9. vscodebot commented on Mar 6, 2020

    @vscodebot

    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

  10. vscodebot commented on Mar 6, 2020

    @vscodebot

    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

  11. vscodebot commented on Mar 6, 2020

    @vscodebot

    🙂 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!

  12. bpasero commented on Nov 4, 2020

    @bpasero
    Contributor

    酷酷的哀殿 (@sunbohong) please merge this with #36951, I feel the 2 suggestions are very similar.

  13. added
    info-needed
    on Nov 4, 2020
  14. sunbohong commented on Nov 4, 2020

    @sunbohong
    ContributorAuthor

    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?

  15. bpasero commented on Nov 4, 2020

    @bpasero
    Contributor

    Some requirements to go with another library such as node-chardet imho are:

    • it runs in web too (that is a requirement that is relatively new)
    • tests of jschardet work in node-chardet (this would give some confidence)
  16. bpasero commented on Nov 10, 2020

    @bpasero
    Contributor

    /duplicate #36951

  17. added
    *duplicate
    on Nov 10, 2020
  18. vscode-triage-bot commented on Nov 10, 2020

    @vscode-triage-bot

    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!

  19. locked and limited conversation to collaborators on Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    *duplicatefeature-requestinfo-needed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions