I recently discovered that the X11 atom WM_NAME is not set in Swing JFrame when LANG is set to C.utf8 but is set for other values of LANG. This occurs on Linux Redhat 8.2 with OpenJDK 11.0.9.
Result with xprop | grep -i name when LANG=C.utf8
_NET_WM_ICON_NAME(UTF8_STRING) = "title 123"
_NET_WM_NAME(UTF8_STRING) = "title 123"
Result with xprop | grep -i name when LANG=en_GB.UTF-8
_NET_WM_ICON_NAME(UTF8_STRING) = "title 123"
WM_ICON_NAME(STRING) = "title 123"
_NET_WM_NAME(UTF8_STRING) = "title 123"
WM_NAME(STRING) = "title 123
Simple JFrame with title used
public class Example {
public static void main(String[] args) {
new javax.swing.JFrame("title 123").setVisible(true);
}
}
I've traced this through to sun.awt.X11.XBaseWindow.updateWMName() which updates both VM_NAME and _NET_WM_NAME unconditionally
XAtom nameAtom = XAtom.get(XAtom.XA_WM_NAME);
nameAtom.setProperty(getWindow(), name);
XAtom netNameAtom = XAtom.get("_NET_WM_NAME");
netNameAtom.setPropertyUTF8(getWindow(), name);
So I'm guessing that somewhere lower in X11 libraries the atom is either not being set or being rejected, possibly to do with character encoding.
I do understand that WM_NAME is legacy and optional and _NET_WM_NAME is the modern replacement. The reason this matters to me is that I maintain some legacy bespoke window manager style code that only looks for WM_NAME. I will be shortly enhancing this to look for _NET_WM_NAME too. I just want to understand this fully for my own academic geeky interest