| 25 Nov 2022 |
psvo | (using flakes) | 16:58:59 |
psvo | i18n.defaultLocale = "en_US.UTF-8"; | 17:03:16 |
psvo | so, it works for me even in zsh (without any custom setup)
% echo '\u00a0'
| 17:11:22 |
K900 | OK I think I found something | 17:17:29 |
K900 | ~
❯ wsl -e /run/current-system/sw/bin/sh -c 'source /etc/set-environment; exec zsh --login'
c/Users/me
❯
~
❯ wsl -e /run/current-system/sw/bin/zsh --login
/home/k900/.zsh/plugins/fzf-tab-completion/zsh/fzf-zsh-completion.sh:4: character not in range
c/Users/me
❯ | 17:17:32 |
K900 | So I guess zsh doesn't like it when the environment isn't set up before it starts | 17:18:08 |
K900 | For some reason | 17:18:10 |
K900 | ❯ wsl -e /run/current-system/sw/bin/sh -c 'export LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive; exec /run/current-system/sw/bin/zsh --login' | 17:20:29 |
K900 | And yep it's specifically LOCALE_ARCHIVE | 17:20:34 |
psvo | hm, I can replicate this too:
wsl -e /nix/store/xa51hl7d89skwwmv9y3w9wi2lw13cq8v-zsh-5.8.1/bin/zsh --login
nixos% echo '\u00a0'
zsh: character not in range
| 17:20:43 |
K900 | And it works fine in child shells because it's already set globally | 17:20:56 |
K900 | And of course LOCALE_ARCHIVE is not in /init's environment because why would it be | 17:21:59 |
psvo | nixos% echo '\u00a0'
zsh: character not in range
nixos% export LC_ALL=en-US.UTF8
nixos% echo '\u00a0'
| 17:23:29 |
K900 | And of course it shoves it in a thread local | 17:23:42 |
psvo | the locale is not UTF8 | 17:23:43 |
K900 | I'm guessing touching any of the LC_ variables will make it reload the locale from disk | 17:24:03 |
K900 | Thus defeating the point | 17:24:07 |
psvo | Well, you can break it even later:
CZsvobodpe02% export LC_ALL=C
CZsvobodpe02% echo '\u00a0'
zsh: character not in range
| 17:25:11 |
K900 | Yeah but that's explicitly setting a non-UTF8 locale | 17:25:24 |
K900 | Oh | 17:27:12 |
K900 | I got it | 17:27:16 |
K900 | I think | 17:27:24 |
K900 | It looks like it's just shoved into the global systemd environment by default | 17:27:36 |
K900 | But somehow that doesn't happen for WSL | 17:28:29 |
K900 | And I think it might be because we're spawning it wrong maybe? | 17:29:43 |
K900 | If this is the fix I am going to mcfuckingloseit | 17:32:18 |
psvo | I'm not sure I follow - I don't have locale-related env vars in /proc/1/environ | 17:32:36 |
K900 | EXACTLY | 17:34:38 |
psvo | hm, for consideration: I've just switched my default locale cs_CZ.UTF8, but the shell spawned by WSL /init is still having LANG=en_US.UTF-8 | 17:38:08 |
K900 | Oh no | 17:38:19 |