VSCode extension does not work if extension dir contains foreign characters

It is not possible to use SonarLint if the absolute path of VSCode extension dir contains a foreign character.
é is in this case, the foreign character.

  • Versions used:
    • SonarLint VSCode extension v. 2.0.0
    • Java v. jre1.8.0_291
  • Errors observed
    • SonarLint does not start properly
  • Steps to reproduce
    • Can be reproduced using following command, as it seems that the extension uses the same way to execute the JAR:
      java -jar c:\Users\JacobHonoré\.vscode\extensions\sonarsource.sonarlint-vscode-2.0.0\server\sonarlint-ls.jar
      • The above returns the following error:
        Error: An unexpected error occurred while trying to open file c:\Users\JacobHonoré\.vscode\extensions\sonarsource.sonarlint-vscode-2.0.0\server\sonarlint-ls.jar
  • Potential workaround
    • I fixed the issue by running VSCode with --extensions-dir="C:\vscode\extensions" which ensures my extensions dir absolute path does not contain any foreign character (é).
    • Another workaround could be if the extension can execute the jar file directly from the extensions directory, and not by using the full absolute path. Executing java -jar .\server\sonarlint-ls.jar while in the C:\Users\JacobHonoré\.vscode\extensions\sonarsource.sonarlint-vscode-2.0.0 seems to work without any issues.

Let me know if you need further information.

1 Like

Hello Jacob.
Welcome to the community and thank you for your report and very useful details.
Sorry for the late reply. I’ve created ticket for this error and you can keep track on progress here.
https://jira.sonarsource.com/browse/SLVSCODE-199

Hi @JacobHonore

I was not able to reproduce your issue. Are you sure the accent is the problem? Could it be that the JAR file is corrupted in c:\Users\JacobHonoré\.vscode\extensions\sonarsource.sonarlint-vscode-2.0.0\server\sonarlint-ls.jar and that switching to a different location for SonarLint extensions forced VSCode to download extensions again?
Do you have a full stack trace of the error?

Hi @Julien_HENRY

Thank you for looking into this!
As you were not able to reproduce the issue, I tried a two more things:

  • Installed a fresh Extension, using c:\vscode\tést as extension dir
  • Installing JDK-8.0.222.10, as I noticed that this is the one you are using.

Unfortunately nothing of the above helped on the issue. I am getting the following error.
Let me know if I can do something to get a more verbose error message.

I just discovered that this might be an issue with the Java launcher: https://bugs.openjdk.java.net/browse/JDK-8205991

I don’t think having a non unicode character in the path is enough to have the issue, or I would have reproduced easily.

May I ask you to provide the following infos:

  • what is your precise version of Windows?
  • can you open a cmd and run chcp to know what is your current code page?
  • can you check the value of the configuration of encoding for non unicode applications:

Thanks

It might very well be an issue with the Java launcher.

  • what is your precise version of Windows?
    • Output of [System.Environment]::OSVersion.Version is 10.0.19043.0
  • can you open a cmd and run chcp to know what is your current code page?
    • Output of chcp is Active code page: 65001
  • can you check the value of the configuration of encoding for non unicode applications:
    • non_unicode_apps

Can you try to change system locale parameter to a language that accepts accents (like French)?

Thank you so much @Julien_HENRY - it helped to change the system locale parameter, but I also had to disable the “Beta: Use Unicode UTF-8 for worldwide language support” feature.

Thanks for the feedback, I guess it might help other people!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.