Search Issue Tracker

By Design

Votes

0

Found in [Package]

2.0.11

Issue ID

VS-47

Regression

Yes

The script encoding is chosen by System Locale setting instead of Unicode in Visual Studio on Windows

Package: Visual Studio

-

How to reproduce:
1. Create a new project
2. Create a new C# Script (Assets > Create > C# Script)
3. Open the newly created script
4. In Visual Studio menu bar go Tools > Customize...
5. In the "Customize" window go to "Commands" tab
6. Press the "Add Command..." button
7. In the "Add Command" window go to "File" category
8. In the "Commands" select "Advanced save options..." and press "Ok" at the bottom
9. Go back to Visual Studio and press on "Advanced save options..."

Expected result: The encoding is set to "Unicode (UTF-8 with signature) - Codepage 65001"
Actual result: The encoding is chosen according to your current System locale

Reproducible with: 2020.2.0a15, 2020.3.20f1, 2021.1.24f1, 2021.2.0b15, 2022.1.0a11
Not reproducible with: 2019.4.31f1, 2020.2.0a14

Reproducible using:
- Visual Studio 2017, Visual Studio 2019 and Visual Studio 2022
Not reproducible using:
- Visual Studio Code, Rider

Workaround:
- Enabling "Beta: Use Unicode UTF-8 for worldwide language support" in the Control Panel > Region > Administrative > Language for non-Unicode programs fixes the issue

  1. Resolution Note:

    Visual Studio encoding settings only apply to files created in Visual Studio. Its possible to change the encoding in visual studio of a file created elsewhere following this:
    https://docs.microsoft.com/en-us/visualstudio/ide/how-to-save-and-open-files-with-encoding?view=vs-2022

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.