Ticket #24940: utf8-file-names-launcher.patch

File utf8-file-names-launcher.patch, 2.8 KB (added by wangi, 11 hours ago)
  • native/linux/latest/usr/bin/josm-latest

    diff --git native/linux/latest/usr/bin/josm-latest native/linux/latest/usr/bin/josm-latest
    index b7887d78f7..58cce230aa 100755
    if [ -f "/etc/default/${JOSM_VERSION}" ]; then  
    5959    . "/etc/default/${JOSM_VERSION}"
    6060fi
    6161
     62# Java decodes file names with the character set of the locale, and -Dsun.jnu.encoding
     63# cannot override it. If the locale is C/POSIX, or cannot be set at all - typically a
     64# UTF-8 LANG whose locale is not installed, as in a Flatpak sandbox - file names are
     65# decoded as ASCII and opening a folder that holds a non-ASCII name fails with
     66# InvalidPathException. Fall back to C.UTF-8 then, which is built into glibc 2.35 and
     67# later. This does not change the language of JOSM: when the locale cannot be set, Java
     68# already falls back to English. LC_ALL is needed, as setlocale() fails as a whole if
     69# any category names a locale that is not installed.
     70if { [ -n "$(locale 2>&1 >/dev/null)" ] || [ "$(locale charmap 2>/dev/null)" = "ANSI_X3.4-1968" ]; } \
     71        && [ -z "$(LC_ALL=C.UTF-8 locale 2>&1 >/dev/null)" ]; then
     72    export LC_ALL=C.UTF-8
     73fi
     74
    6275# If there is more than 8G ram, we can use up to 75% of the memory while still leaving 2G for other things.
    6376if [ "$(LC_ALL=C LANG=C free --mega | grep '^Mem:' | awk '{print $2}')" -gt 8192 ]; then
    6477    # But don't set anything if JAVA_OPTS is already set.
  • native/linux/tested/usr/bin/josm

    diff --git native/linux/tested/usr/bin/josm native/linux/tested/usr/bin/josm
    index f8d8f2e498..b84a517f8e 100755
    if [ -f "/etc/default/${JOSM_VERSION}" ]; then  
    5959    . "/etc/default/${JOSM_VERSION}"
    6060fi
    6161
     62# Java decodes file names with the character set of the locale, and -Dsun.jnu.encoding
     63# cannot override it. If the locale is C/POSIX, or cannot be set at all - typically a
     64# UTF-8 LANG whose locale is not installed, as in a Flatpak sandbox - file names are
     65# decoded as ASCII and opening a folder that holds a non-ASCII name fails with
     66# InvalidPathException. Fall back to C.UTF-8 then, which is built into glibc 2.35 and
     67# later. This does not change the language of JOSM: when the locale cannot be set, Java
     68# already falls back to English. LC_ALL is needed, as setlocale() fails as a whole if
     69# any category names a locale that is not installed.
     70if { [ -n "$(locale 2>&1 >/dev/null)" ] || [ "$(locale charmap 2>/dev/null)" = "ANSI_X3.4-1968" ]; } \
     71        && [ -z "$(LC_ALL=C.UTF-8 locale 2>&1 >/dev/null)" ]; then
     72    export LC_ALL=C.UTF-8
     73fi
     74
    6275# If there is more than 8G ram, we can use up to 75% of the memory while still leaving 2G for other things.
    6376if [ "$(LC_ALL=C LANG=C free --mega | grep '^Mem:' | awk '{print $2}')" -gt 8192 ]; then
    6477    # But don't set anything if JAVA_OPTS is already set.