Bug 511086

Summary: Wrong locale is set for applications launched in Plasma
Product: [Plasma] plasmashell Reporter: admin
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: gerrit.huebbers, kde
Priority: NOR    
Version First Reported In: 6.5.0   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: test program

Description admin 2025-10-25 11:27:11 UTC
Created attachment 186124 [details]
test program

SUMMARY

Wrong locale is set for applications launched in KDE Wayland session, for Qt based application following warning is emit:
Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
If this causes problems, reconfigure your locale. See the locale(1) manual
for more information.

A small test program is written, running from terminal or ssh session the locale output is right (same as locale settings), while running from KDE Konsole the output is wrong (C / ANSI_X3.4-1968).

----- Output from terminal -----
Locale environment variables:
LANG=en_US.UTF-8
LC_ALL=(unset)
LC_COLLATE=(unset)
LC_CTYPE=C.UTF-8
LC_MONETARY=(unset)
LC_NUMERIC=(unset)
LC_TIME=(unset)
LC_MESSAGES=(unset)
LC_PAPER=(unset)
LC_NAME=(unset)
LC_ADDRESS=(unset)
LC_TELEPHONE=(unset)
LC_MEASUREMENT=(unset)
LC_IDENTIFICATION=(unset)

Default LC_NUMERIC: en_US.UTF-8
Default LC_TIME: en_US.UTF-8
Default LC_CTYPE: C.UTF-8
Default CODESET: UTF-8

New LC_NUMERIC: en_US.UTF-8
New LC_TIME: en_US.UTF-8
New LC_CTYPE: en_US.UTF-8
New CODESET: UTF-8

----- Output from Konsole -----
LANG=en_US.UTF-8
LC_ALL=(unset)
LC_COLLATE=(unset)
LC_CTYPE=C.UTF-8
LC_MONETARY=(unset)
LC_NUMERIC=(unset)
LC_TIME=en_GB.UTF-8
LC_MESSAGES=(unset)
LC_PAPER=(unset)
LC_NAME=(unset)
LC_ADDRESS=(unset)
LC_TELEPHONE=(unset)
LC_MEASUREMENT=(unset)
LC_IDENTIFICATION=(unset)

Default LC_NUMERIC: C
Default LC_TIME: C
Default LC_CTYPE: C
Default CODESET: ANSI_X3.4-1968

New LC_NUMERIC: en_US.UTF-8
New LC_TIME: en_US.UTF-8
New LC_CTYPE: en_US.UTF-8
New CODESET: UTF-8

----- configs -----
$ cat /etc/locale.conf
LANG=en_US.UTF-8
LC_CTYPE=C.UTF-8

$ cat .config/plasma-localerc
[Formats]
LANG=en_US.UTF-8
LC_MEASUREMENT=C
LC_TIME=en_GB.UTF-8

$ locale
LANG=en_US.UTF-8
LC_CTYPE=C.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=C
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


STEPS TO REPRODUCE
1. Set system and KDE locales to the same settings above
2. Check "locale" output is UTF-8
3. Run the test program, check default locale output

OBSERVED RESULT
Default locale is "C"

EXPECTED RESULT
Default locale should be "en_US.UTF-8"

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 6.5.0
KDE Frameworks Version: 6.19.0
Qt Version: 6.10.0
Kernel Version: 6.17.4-4-cachyos (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen AI 7 H 350 w/ Radeon 860M
Memory: 32 GiB of RAM (29.0 GiB usable)
Graphics Processor 1: AMD Radeon 860M Graphics
Graphics Processor 2: NVIDIA GeForce RTX 5060 Laptop GPU
Comment 1 admin 2025-10-25 11:32:11 UTC
The issue only happens if locale is configured from Plasma settings, if I remove .config/plasma-localerc then the test is ok.