Terminal: No background image displayed if "backgroundImage" is set to a path that contains accented chars.

Created on 23 May 2020  路  16Comments  路  Source: microsoft/terminal

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.

Area-Settings Area-TerminalControl Help Wanted Issue-Bug Priority-2 Product-Terminal

Most helpful comment

Ah! Sorry I misunderstood you. I didn鈥檛 phrase my question very well.

I鈥檒l pop this back into the triage queue. It鈥檚 absolutely not a design decision to not support anybody who doesn鈥檛 speak only English.

All 16 comments

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

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

Yes, it does.

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!

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!

Ah! Sorry I misunderstood you. I didn鈥檛 phrase my question very well.

I鈥檒l pop this back into the triage queue. It鈥檚 absolutely not a design decision to not support anybody who doesn鈥檛 speak only English.

In general, we don鈥檛 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!

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

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

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.

Hi,

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

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? 馃

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

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

not working

image

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

ANSI: E9 - Not working
image

Thank you for your help. You made my day. :smiley:

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:

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. 馃槂

Was this page helpful?
0 / 5 - 0 ratings