cd /news/hardware/solution-for-locale-and-character-en… · home topics hardware article
[ARTICLE · art-13202] src=gist.github.com ↗ pub= topic=hardware verified=true sentiment=· neutral

Solution for locale and character encoding issues in Japanese games on Steam Deck

The article explains two common issues when running Japanese games on Steam Deck: non-ASCII filenames not being accessible due to locale mismatches, and Japanese text displaying as mojibake or causing game crashes due to incorrect Windows ANSI codepage settings. It provides solutions for each problem, such as setting `LANG=en_US.utf8` in launch options for filename access and using `HOST_LC_ALL=ja_JP.UTF-8` for Japanese text support, but notes these fixes are mutually exclusive. The article then offers a workaround using a custom locale directory and `run.sh` script to enable both UTF-8 and Japanese Shift-JIS support simultaneously without requiring root access.

read2 min views22 publishedAug 22, 2022

Cannot access filenames containing non-ASCII characters.

Steam Deck's SteamOS 3 provides only one locale named en_US.utf8 (as configured in /etc/locale.gen) but /etc/locale.conf sets LANG to en_US.UTF-8. They don't match, so the effective locale for programs is C and the character set becomes limited to ASCII.

Set the game's launch options in Steam to LANG=en_US.utf8 %command% to solve this.

To fix this for all applications running in desktop mode (eg. to correctly extract games), create a file named ~/.config/plasma-workspace/env/utf8.sh containing (restart desktop mode to apply):

#!/bin/sh
export LANG=en_US.utf8

Japanese text displays as mojibake or question marks. Some games may even completely fail to load due to script compilation errors (common in visual novels). The Windows ANSI codepage must be set to SHIFT-JIS to fix this.

Wine uses the current system locale (set via LANG) or the LC_ALL environment variable to determine which ANSI codepage to use. This is equivalent to using Locale Emulator on Windows.

Steam Deck's SteamOS 3 doesn't provide a ja_JP.UTF-8 locale so this leaves LC_ALL.

However Steam may override it, so instead set the game's launch options to HOST_LC_ALL=ja_JP.UTF-8 %command% to have Proton set LC_ALL to the desired value.

The simple solutions shown above to problem 1 and 2 are unfortunately mutually exclusive.

ja_JP.UTF-8 is not provided by SteamOS 3 so requesting it makes the effective Unix locale fallback to C (ASCII) again.

This sets the Wine codepage to Japanese and the Unix character set to UTF-8 without requiring root access or unlocking the readonly system partition of the Steam Deck.

  1. Extract the archive steam-deck-jp-locale-utf8.tar.zst using Ark into the home directory on the Steam Deck (/home/deck).
  2. Double-check that /home/deck/locales/run.sh is executable (right click > properties > permissions).
  3. Set the game's launch options to LANG=ja_JP.UTF-8 ~/locales/run.sh %command% to fix locale and encoding issues.

Alternative steps #

Follow these steps instead to generate the files manually. A full install of Arch Linux is required (commands may need adjustments to work in other distributions).

  1. On an Arch Linux install:
    1. Uncomment ja_JP.UTF-8 in /etc/locale.gen
    2. Run the following commands:
      sudo locale-gen
      
      mkdir locales
      export LOCPATH="$HOME/locales"
      localedef -f UTF-8 -i ja_JP "$LOCPATH/ja_JP.UTF-8"
      
  2. Transfer the locales directory created above into /home/deck on your Steam Deck (SteamOS 3).
  3. Create a file named run.sh inside that folder containing:
    #!/bin/bash
    newlocpath=$(dirname "$(realpath "$0")")
    script='
      BEGIN { FS=OFS=" '"'--'"' " }
      NF > 1 { for(i = 1; i < NF; ++i) printf "%s", $i OFS; }
      { print "env LOCPATH='"'"'" newlocpath "'"'"' " $NF }
    '
    command="$(awk -v newlocpath="$newlocpath" "$script" <<< "${@@Q}")"
    eval "$command"
    
  4. Make run.sh executable: chmod +x ~/locales/run.sh
  5. Set the game's launch options to LANG=ja_JP.UTF-8 ~/locales/run.sh %command% to fix locale and encoding issues.
  • https://github.com/wine-mirror/wine/blob/120ca2ff52d145faa925a41d494035842d47a967/dlls/ntdll/unix/env.c#L804-L805
  • https://github.com/wine-mirror/wine/blob/120ca2ff52d145faa925a41d494035842d47a967/dlls/ntdll/unix/env.c#L715-L719
  • https://github.com/ValveSoftware/Proton/blob/4221d9ef07cc38209ff93dbbbca9473581a38255/proton#L1081-L1087
  • PROTON_LOG=1 WINEDEBUG=+file,+nls,+msgbox %command% to troubleshoot file accesses, locales/character set conversions and message box contents.
── more in #hardware 4 stories · sorted by recency
── more on @steam deck 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/solution-for-locale-…] indexed:0 read:2min 2022-08-22 ·