microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.48k stars 822 forks source link

Ubuntu 1804 - Default 'locale' setting results in portability issues because response to prompts are required to be UPPER case only! #3516

Closed mi-hol closed 5 years ago

mi-hol commented 6 years ago

Windows build number: Microsoft Windows [Version 10.0.17134.228] with Ubuntu 1804 distribution and Windows host set to 'culture' German (Germany) but Windows UI language = English(US)

Get-Culture

LCID             Name             DisplayName
----             ----             -----------
1031             de-DE            German (Germany)
  1. install powershell-preview RC1 according to: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1804
# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
sudo curl -o /etc/apt/sources.list.d/microsoft.list https://packages.microsoft.com/config/ubuntu/18.04/prod.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell-preview

# Start PowerShell
pwsh-preview
Get-Culture
Set-Content foo.txt -Value "hi" ; $ConfirmPreference="low"; Remove-Item foo.txt

2018-08-24 10_10_23-window

Confirmation that standard Ubuntu 18.04 in a VM doesn't show this issue https://github.com/PowerShell/PowerShell/issues/7639 due to a different LCID. Also issue does NOT appear in Ubuntu 1704! I failed to set a different locale due to error

sudo localectl
Failed to create bus connection: No such file or directory
mi-hol commented 6 years ago

could be related to https://github.com/Microsoft/WSL/issues/3018

therealkenc commented 5 years ago

could be related to #3018

Probably not directly unless WSLENV is in play somehow here, which I don't think it is. The problem over there is a pretty specific bad interaction.

sudo localectl

That isn't going to work because no systemd

install Ubuntu 1804 =>results in a strange locale 'en-US-POSIX' that I was unable to change!

No need to yell.

$ sudo locale-gen de_DE.UTF-8
$ sudo update-locale LANG=de_DE.UTF-8

image

Notably enough, whatever behavior PowerShell exhibiting with en-US-POSIX (assuming it is even incorrect behavior) is going to be the same on Real Linux

mi-hol commented 5 years ago

Thanks @therealkenc Good to have a workaround but what really concerns me is the different behavior of WSL Ubuntu1704 and WSL Ubuntu1804 in this matter.

PS: not sure to understand your comment 'No need to yell.'

therealkenc commented 5 years ago

but what really concerns me is the different behavior of WSL Ubuntu1704 and WSL Ubuntu1804 in this matter.

The launcher changed between 16.04 and 18.04 may be the cause of this (analogous to but different than #3273). There is no difference in WSL behavior, and WSL does not control Ubuntu behavior.

PS: not sure to understand your comment 'No need to yell.'

Ausrufezeichen übersetzt schlecht

mi-hol commented 5 years ago

Symbolische Bedeutungen aus https://de.wikipedia.org/wiki/Ausrufezeichen Das Ausrufezeichen steht allgemein für ‚wichtig‘, insbesondere für eine Warnung (‚Achtung‘), oder für ‚Gefahr‘ und ‚Gefährdung‘. Achtung vor Gefahr! (Straßenverkehr, international üblich)

image

therealkenc commented 5 years ago

That road sign translates badly too. I changed my locale to en_CA and all I got was:

image