Skip to content

Garbled characters when importing multiple folders into the workspace #85870

Closed

Description

@rihalvnium76

Issue Type: Bug

Directly importing folders with Chinese names is normal. However, if I first import a folder with an English name (e.g. D: \ npMingw \ mingw), and then import a folder with a Chinese name (e.g. D: \ Data \测试), the import with a Chinese name will fail. The name of the folder in the workspace becomes garbled code, and prompts "Can not resolve workspace folder"

VS Code version: Code 1.40.2 (f359dd6, 2019-11-25T14:54:45.096Z)
OS version: Windows_NT x64 10.0.17134

Extensions (4)
Extension Author (truncated) Version
vscode-language-pack-zh-hans MS- 1.40.2
cpptools ms- 0.26.1
vscode-code-runner wan 0.9.6
material-theme zhu 3.1.2

(4 theme extensions excluded)

Activity

  1. added
    info-needed
    on Dec 1, 2019
  2. sandy081 commented on Dec 1, 2019

    @sandy081
    Member

    Can you please open the workspace configuration file and see the entry that is corresponding to the folder 测试. You can use the command Open Workspace Configuration File to open it.

  3. rihalvnium76 commented on Dec 1, 2019

    @rihalvnium76
    Author

    Open Workspace Configuration File

    The configuration file can be opened, but it displays garbled characters.
    And I found that the encoding of the configuration file is Windows-1252, it seems that this encoding does not support Simplified Chinese.
    (This garbled problem has existed from the previous version to the current version, and still has not been fixed)
    图片

  4. sandy081 commented on Dec 1, 2019

    @sandy081
    Member

    If you fix this file by changing the encoding and updating the path then it works?

  5. rihalvnium76 commented on Dec 1, 2019

    @rihalvnium76
    Author

    If you fix this file by changing the encoding and updating the path then it works?

    Not exactly working. The problem persists.
    I tried to modify the configuration file encoding to UTF-8 and save it, but it didn't work.
    After that, I tried to remove the folder with Chinese name, opened the workspace configuration file, used "Reopen with Encoding" and selected UTF-8 (not saved), and then re-added the directory with Chinese name, VSCode was able to resolve .
    However, when I close the workspace configuration file opened in the editor, and then add another directory with Chinese name, or remove the directory with Chinese name added before, and then add the directory again, VSCode cannot resolve the directory again. The configuration file also became garbled, and its encoding changed back to Windows-1252.
    It seems that VSCode fixedly uses Windows-1252 encoding instead of automatic recognition to read and write some configuration files.

  6. sandy081 commented on Dec 2, 2019

    @sandy081
    Member

    Will wait for Benjamin Pasero (@bpasero) insights.

  7. added
    bug
    workbench-multiroot
    and removed
    info-needed
    on Dec 5, 2019
  8. bpasero commented on Dec 5, 2019

    @bpasero
    Contributor

    This can happen if an encoding is configured that is not UTF-8. We have overrides in place that can enforce an encoding but we missed to specify it for untitled workspaces. I added that now here:

    defaultEncodingOverrides.push({ extension: WORKSPACE_EXTENSION, encoding: UTF8 });

  9. added
    verified
    on Dec 6, 2019
  10. locked and limited conversation to collaborators on Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugfile-encodingverifiedworkbench-multiroot

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions