Settings might not load correctly if file is saved as ANSI, not UTF-8 (WAS: No background image displayed if set to a path that contains accented chars.) #8532

Open
opened 2026-01-31 01:31:48 +00:00 by claunia · 16 comments
Owner

Originally created by @gcsizmadia on GitHub (May 23, 2020).

Environment

Windows build number: 10.0.18363.836
Windows Terminal version (if applicable): 1.0.1401.0

Any other software? No.

Steps to reproduce

Set $.profiles.defaults.backgroundImage to a path that contains accented chars.
For example Pictures in Hungarian is Képek, so my path setting is like:
"backgroundImage": "C:\\Users\\Gabor\\Képek\\picture.png"

Expected behavior

The selected image is expected to be displayed as the background image.

Actual behavior

No background image is dispayed as if I did not set $.profiles.defaults.backgroundImage.

Please note:
if the same image is in my Desktop directory which is Asztal in Hungarian ("backgroundImage": "C:\\Users\\Gabor\\Asztal\\picture.png") then the picture is displayed correctly.

Originally created by @gcsizmadia on GitHub (May 23, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18363.836 Windows Terminal version (if applicable): 1.0.1401.0 Any other software? No. ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> Set `$.profiles.defaults.backgroundImage` to a path that contains accented chars. For example `Pictures` in Hungarian is `Képek`, so my path setting is like: `"backgroundImage": "C:\\Users\\Gabor\\Képek\\picture.png"` # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> The selected image is expected to be displayed as the background image. # Actual behavior <!-- What's actually happening? --> No background image is dispayed as if I did not set `$.profiles.defaults.backgroundImage`. **Please note:** if the same image is in my `Desktop` directory which is `Asztal` in Hungarian (`"backgroundImage": "C:\\Users\\Gabor\\Asztal\\picture.png"`) then the picture is displayed correctly.
Author
Owner

@DHowett commented on GitHub (May 24, 2020):

If you use the word Pictures instead of Képek, does it work?

@DHowett commented on GitHub (May 24, 2020): If you use the word `Pictures` instead of `Képek`, does it work?
Author
Owner

@gcsizmadia commented on GitHub (May 24, 2020):

If you use the word Pictures instead of Képek, does it work?

Yes, it does.

@gcsizmadia commented on GitHub (May 24, 2020): > If you use the word `Pictures` instead of `Képek`, does it work? Yes, it does.
Author
Owner

@DHowett commented on GitHub (May 24, 2020):

Okay. So... The pictures folder is actually named Pictures on disk, and it's got a desktop.ini file in it that changes the display name to Képek. There's nothing we can really do about that, unfortunately.

Best recommendation: when using localized paths, please use "copy as path" (shift+right-click in explorer) to get the actual final filename.

Thanks!

@DHowett commented on GitHub (May 24, 2020): Okay. So... The pictures folder is _actually_ named `Pictures` on disk, and it's got a `desktop.ini` file in it that changes the _display name_ to Képek. There's nothing we can really do about that, unfortunately. Best recommendation: when using localized paths, please use "copy as path" (shift+right-click in explorer) to get the actual final filename. Thanks!
Author
Owner

@gcsizmadia commented on GitHub (May 24, 2020):

Okay. So... The pictures folder is actually named Pictures on disk, and it's got a desktop.ini file in it that changes the display name to Képek. There's nothing we can really do about that, unfortunately.

Best recommendation: when using localized paths, please use "copy as path" (shift+right-click in explorer) to get the actual final filename.

Thanks!

Unfortunately your guess is wrong and at least you could have waited my confirmation before you close this issue in a hurry.

The above mentioned folder name is actually Képek, it is not the display name stored in the desktop.ini file. It has really nothing to do with localized paths. I actually moved/redirected my personal folders (using Properties window Location tab) to another drive and I created the new folders explicitly with Hungarian names beforehand.

When I said yes to your last question then I meant that if I put the image into a folder the name of which is Picture then it works (of course only if other parts of the full path also do not contain accented chars).

Have you tried creating a folder with accented chars at all?

If you did then you could reproduce the issue and I really hope that is not a design decision to support paths containing characters only from the English alphabet.

Additionally, not just special folders' name (e.g. Pictures) but a user name can also contain accented chars, e.g. my name in Hungarian is written with accent Gábor and if it would be my user name (it could be, Windows allows that) then no picture under my profile folder would be displayed in Windows Terminal as background.

I think every path with any kind of character that Windows can handle should be handled by Windows Terminal as well.

So please consider re-opening this issue and take the time to investigate it correctly because it is an issue.

Thanks in advance!

@gcsizmadia commented on GitHub (May 24, 2020): > Okay. So... The pictures folder is _actually_ named `Pictures` on disk, and it's got a `desktop.ini` file in it that changes the _display name_ to Képek. There's nothing we can really do about that, unfortunately. > > Best recommendation: when using localized paths, please use "copy as path" (shift+right-click in explorer) to get the actual final filename. > > Thanks! Unfortunately your guess is wrong and at least you could have waited my confirmation before you close this issue in a hurry. The above mentioned folder name is _actually_ `Képek`, it is not the display name stored in the `desktop.ini` file. It has really nothing to do with localized paths. I actually moved/redirected my personal folders (using Properties window Location tab) to another drive and I created the new folders explicitly with Hungarian names beforehand. When I said yes to your last question then I meant that if I put the image into a folder the name of which is `Picture` then it works (of course only if other parts of the full path also do not contain accented chars). Have you tried creating a folder with accented chars at all? If you did then you could reproduce the issue and I really hope that is not a design decision to support paths containing characters only from the English alphabet. Additionally, not just special folders' name (e.g. `Pictures`) but a user name can also contain accented chars, e.g. my name in Hungarian is written with accent `Gábor` and if it would be my user name (it could be, Windows allows that) then no picture under my profile folder would be displayed in Windows Terminal as background. **I think every path with any kind of character that Windows can handle should be handled by Windows Terminal as well.** So please consider re-opening this issue and take the time to investigate it correctly because it **_is_** an issue. Thanks in advance!
Author
Owner

@DHowett commented on GitHub (May 24, 2020):

Ah! Sorry I misunderstood you. I didn’t phrase my question very well.

I’ll pop this back into the triage queue. It’s absolutely not a design decision to not support anybody who doesn’t speak only English.

@DHowett commented on GitHub (May 24, 2020): Ah! Sorry I misunderstood you. I didn’t phrase my question very well. I’ll pop this back into the triage queue. It’s absolutely not a design decision to not support anybody who doesn’t speak only English.
Author
Owner

@DHowett commented on GitHub (May 24, 2020):

In general, we don’t treat closed discussions on this repository as final. Everything is worth continued discussion, and if a bug is closed wrongly or duplicated to the wrong thing or even comes back in a later version I encourage people to continue talking about it!

@DHowett commented on GitHub (May 24, 2020): In general, we don’t treat closed discussions on this repository as final. Everything is worth continued discussion, and if a bug is closed wrongly or duplicated to the wrong thing or even comes back in a later version I _encourage_ people to continue talking about it!
Author
Owner

@gcsizmadia commented on GitHub (May 24, 2020):

Thank you very much. I really appreciate it and hope my answer was not offensive in any way. :)

@gcsizmadia commented on GitHub (May 24, 2020): Thank you very much. I really appreciate it and hope my answer was not offensive in any way. :)
Author
Owner

@DHowett commented on GitHub (May 24, 2020):

So, I am having some trouble reproducing this with a variety of characters:

image

	,"backgroundImage": "C:\\Users\\Dustin\\🕻\\früh\\Képek\\tom.png"
	,"backgroundImageAlignment": "bottomRight"
	,"backgroundImageStretchMode": "uniform"

From PowerShell, could you run...

chcp
[char[]](get-item ~\Képek\ | select -expand Name) | %{"{0:X4} " -f [int]$_}

?

When I run that, I get this:

Active code page: 437
004B
00E9
0070
0065
006B
@DHowett commented on GitHub (May 24, 2020): So, I _am_ having some trouble reproducing this with a variety of characters: ![image](https://user-images.githubusercontent.com/189190/82745827-7f263e00-9d3d-11ea-931a-7ff2cc5f1807.png) ```jsonc ,"backgroundImage": "C:\\Users\\Dustin\\🕻\\früh\\Képek\\tom.png" ,"backgroundImageAlignment": "bottomRight" ,"backgroundImageStretchMode": "uniform" ``` From PowerShell, could you run... ```powershell chcp [char[]](get-item ~\Képek\ | select -expand Name) | %{"{0:X4} " -f [int]$_} ``` ? When I run that, I get this: ``` Active code page: 437 004B 00E9 0070 0065 006B ```
Author
Owner

@gcsizmadia commented on GitHub (May 24, 2020):

Yes, sure.

For this test I placed the same image into two different folders:

image

First I set the background image to C:\Temp\Pictures\Képek\img0_1024x768.jpg

I opened Windows Terminal and typed in the suggested commands with aligning the Get-Item cmdlet's parameter to refer to C:\Temp\Pictures\Képek folder.

The result:

image

Then I set the background image to C:\Temp\Pictures\img0_1024x768.jpg

The exact same instance of the Windows Terminal window:

image

Additionally, I also tried renaming the file itself by replacing x to × ("\u00D7") char:

  • the original file path is: C:\Temp\Pictures\img0_1024x768.jpg
  • the modified file path is: C:\Temp\Pictures\img0_1024×768.jpg

As I expected the background image vanished from the Windows Terminal window in this case as well.

@gcsizmadia commented on GitHub (May 24, 2020): Yes, sure. For this test I placed the same image into two different folders: ![image](https://user-images.githubusercontent.com/8214318/82762343-b873b200-9e00-11ea-98e0-41bd8ec5df49.png) First I set the background image to `C:\Temp\Pictures\Képek\img0_1024x768.jpg` I opened Windows Terminal and typed in the suggested commands with aligning the `Get-Item` cmdlet's parameter to refer to `C:\Temp\Pictures\Képek` folder. The result: ![image](https://user-images.githubusercontent.com/8214318/82762627-59af3800-9e02-11ea-8f7d-fcd9deef5235.png) Then I set the background image to `C:\Temp\Pictures\img0_1024x768.jpg` The exact same instance of the Windows Terminal window: ![image](https://user-images.githubusercontent.com/8214318/82762638-6fbcf880-9e02-11ea-881e-8ae48c13c9f0.png) Additionally, I also tried renaming the file itself by replacing `x` to `×` (`"\u00D7"`) char: - the original file path is: `C:\Temp\Pictures\img0_1024x768.jpg` - the modified file path is: `C:\Temp\Pictures\img0_1024×768.jpg` As I expected the background image vanished from the Windows Terminal window in this case as well.
Author
Owner

@gcsizmadia commented on GitHub (May 31, 2020):

Hi,

I'm just wondering if there is any progress on this issue.
Did my last comment help?
Is there anything I can do?

@gcsizmadia commented on GitHub (May 31, 2020): Hi, I'm just wondering if there is any progress on this issue. Did my last comment help? Is there anything I can do?
Author
Owner

@DHowett commented on GitHub (Jun 2, 2020):

I'm moving this into the 1.x milestone, but I don't have any leads on it. I marked it "Help Wanted", in case there's somebody out there with a better idea.

It's likely codepage-related, but my understanding was that we should be using UTF-8 and things should be cleaned up on the way in . . . but if they're not, that's unpleasant.

Do we need to manifest our process for UTF-8ness and let the OS deal with the fallout? 🤔

@DHowett commented on GitHub (Jun 2, 2020): I'm moving this into the 1.x milestone, but I don't have any leads on it. I marked it "Help Wanted", in case there's somebody out there with a better idea. It's likely codepage-related, but my understanding was that we should be using UTF-8 and things should be cleaned up on the way in . . . but if they're not, that's unpleasant. Do we need to manifest our process for UTF-8ness and let the OS deal with the fallout? 🤔
Author
Owner

@gcsizmadia commented on GitHub (Jul 7, 2020):

I'm just wondering if there is any news on this issue.

@gcsizmadia commented on GitHub (Jul 7, 2020): I'm just wondering if there is any news on this issue.
Author
Owner

@DHowett commented on GitHub (Jul 8, 2020):

So, since I don't have anybody I can pull to look at this issue, I installed Windows and switched it to Hungarian. 😄

I'm still having trouble really reproducing this issue, but I did find one thing that might be interesting.

  • If you open settings.json in Notepad, does the status bar say UTF-8 or ANSI in the bottom right?
  • Can you zip up a copy of settings.json and share it?

working

image

not working

image

@DHowett commented on GitHub (Jul 8, 2020): So, since I don't have anybody I can pull to look at this issue, I installed Windows and switched it to Hungarian. :smile: I'm still having trouble really reproducing this issue, but I did find one thing that might be interesting. * If you open `settings.json` in Notepad, does the status bar say **UTF-8** or **ANSI** in the bottom right? * Can you zip up a copy of `settings.json` and share it? ### working ![image](https://user-images.githubusercontent.com/189190/86862128-71264580-c07d-11ea-94cc-43e76a296a98.png) ### not working ![image](https://user-images.githubusercontent.com/189190/86862179-8ef3aa80-c07d-11ea-83ac-54a6ce8911dc.png)
Author
Owner

@gcsizmadia commented on GitHub (Jul 8, 2020):

So, since I don't have anybody I can pull to look at this issue, I installed Windows and switched it to Hungarian. 😄

Nice. 😄 How do you feel about it? 😃

I'm still having trouble really reproducing this issue, but I did find one thing that might be interesting.

  • If you open settings.json in Notepad, does the status bar say UTF-8 or ANSI in the bottom right?

You are a genius. 😎 You found it.

I checked my settings.json file and voila! It was stored as ANSI.
As soon as I converted the file to UTF-8 the background image immediately appeared.

The strange thing is that on my host OS it is stored as ANSI but in my VM it is stored as UTF-8.

I usually edited these files in Visual Studio 2015 (on host) and 2019 (in vm).
Maybe Notepad++ as well but that does not change the encoding unless I do so.
So I didn't even think that could be the reason for this issue.
What a tiny but important detail!

UTF-8: C3 A9 - Working
image

ANSI: E9 - Not working
image

Thank you for your help. You made my day. 😃

@gcsizmadia commented on GitHub (Jul 8, 2020): > So, since I don't have anybody I can pull to look at this issue, I installed Windows and switched it to Hungarian. 😄 Nice. :smile: How do you feel about it? :smiley: > I'm still having trouble really reproducing this issue, but I did find one thing that might be interesting. > > * If you open `settings.json` in Notepad, does the status bar say **UTF-8** or **ANSI** in the bottom right? You are a genius. :sunglasses: You found it. I checked my `settings.json` file and voila! It was stored as ANSI. As soon as I converted the file to UTF-8 the background image immediately appeared. The strange thing is that on my host OS it is stored as ANSI but in my VM it is stored as UTF-8. I usually edited these files in Visual Studio 2015 (on host) and 2019 (in vm). Maybe Notepad++ as well but that does not change the encoding unless I do so. So I didn't even think that could be the reason for this issue. What a tiny but important detail! UTF-8: `C3 A9` - Working ![image](https://user-images.githubusercontent.com/8214318/86953230-6ee2ea80-c154-11ea-9992-183a60472913.png) ANSI: `E9` - Not working ![image](https://user-images.githubusercontent.com/8214318/86953097-37743e00-c154-11ea-9708-a04701afaf48.png) Thank you for your help. You made my day. :smiley:
Author
Owner

@DHowett commented on GitHub (Jul 8, 2020):

How do you feel about it?

I feel like I need a whole bunch of VMs to do testing on now! 😁

I'm so sorry it took this long!

There may be a way for Terminal to detect this and at least issue a warning... it would be better than silent failure! I'm going to file a followup workitem for that.

Thanks again for being patient 😄

@DHowett commented on GitHub (Jul 8, 2020): > How do you feel about it? I feel like I need a whole bunch of VMs to do testing on now! :grin: I'm so sorry it took this long! There may be a way for Terminal to detect this and at least issue a warning... it would be better than silent failure! I'm going to file a followup workitem for that. Thanks again for being patient :smile:
Author
Owner

@gcsizmadia commented on GitHub (Jul 9, 2020):

I'm so sorry it took this long!

No problem. I'm always happy if an issue is resolved.

There may be a way for Terminal to detect this and at least issue a warning... it would be better than silent failure! I'm going to file a followup workitem for that.

In the past I wrote a C# method that detects if the file is stored as ANSI 1250 and if yes then converts it to UTF-8.
Of course it's a bit hacky as the text file encoding could not really be detected unless it's UTF-8 with BOM.
But it works. 😃

I will share it happily if you think it could help.
At least it may give you an idea from which you can start your own algorithm.

Thanks again for being patient 😄

It's one of my skills. 😃

@gcsizmadia commented on GitHub (Jul 9, 2020): > I'm so sorry it took this long! No problem. I'm always happy if an issue is resolved. > There may be a way for Terminal to detect this and at least issue a warning... it would be better than silent failure! I'm going to file a followup workitem for that. In the past I wrote a C# method that detects if the file is stored as ANSI 1250 and if yes then converts it to UTF-8. Of course it's a bit hacky as the text file encoding could not really be detected unless it's UTF-8 with BOM. But it works. 😃 I will share it happily if you think it could help. At least it may give you an idea from which you can start your own algorithm. > Thanks again for being patient 😄 It's one of my skills. 😃
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8532