Changeset 19637 in josm for trunk/native/linux


Ignore:
Timestamp:
2026-10-06T08:57:52+02:00 (4 days ago)
Author:
stoecker
Message:

detect the UTF-8 filename issue in non-UTF contexts, patch by wangi, fix #24940

Location:
trunk/native/linux
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/native/linux/latest/usr/bin/josm-latest

    r19430 r19637  
    5858    # shellcheck source=/etc/default/josm-latest
    5959    . "/etc/default/${JOSM_VERSION}"
     60fi
     61
     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
    6073fi
    6174
  • trunk/native/linux/tested/usr/bin/josm

    r19430 r19637  
    5858    # shellcheck source=/etc/default/josm
    5959    . "/etc/default/${JOSM_VERSION}"
     60fi
     61
     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
    6073fi
    6174
Note: See TracChangeset for help on using the changeset viewer.