Encode::X11(3pm)
π Encode::X11 π
okay bestie, welcome to Encode::X11 β a lil' user-contributed Perl manual page (3pm, if we're being official) all about character encodings for X11. yes she's niche. yes she's iconic. let's get into it π«Ά
β¨ NAME β¨
Encode::X11 β character encodings for X11. that's it, that's the whole vibe. π
π¦ SYNOPSIS π¦
look at her go, so concise:
use Encode;
use Encode::X11;
my $chars = Encode::decode ('x11-compound-text', $bytes);
literally three lines and you're already decoding. main character energy fr fr β¨
πΈ DESCRIPTION πΈ
so this module encodes and decodes X11 ICCCM "compound text" strings. the name for that is:
x11-compound-text
Compound text shows up in window properties of type COMPOUND_TEXT. ngl, it's not really a thing you'd use outside of that context β it's giving very much "only exists in this one specific situation." π
What is compound text though? It's made of ISO-2022 style escape sequences that switch among various basic charsets β including the ISO-8859 series, JIS, KSC, and GB. switching between charsets mid-string, like a little fashion show of encodings. obsessed. π
The plain name x11-compound-text tries to encode in a sensible and compatible way. Maybe someday there'll be options or variations for which charsets to use β but not today, bestie. For now, encoding prefers the original ICCCM charsets latin-N, JIS, KSC and GB for the benefit of older X clients, and then falls back to the newer utf-8 encoding when necessary. respecting the elders first, slay. π
The decode is meant to recognise anything, but lowkey it may be a bit limited yet. Maybe one day it could just be a full ISO-2022 decode, if/when that might exist β but for now it's done explicitly and might potentially cope with X11 specifics. we're doing our best, okay π
heads up!! Decodingcns11643segments requires theEncode::HanExtramodule. Those segments aren't normally generated by the Xlib conversions (as of X.org libX11 1.4.0). So have HanExtra available if you think you might encounter them β don't get caught lacking. π
Also, Emacs has some "private encoding" sequences for big5. They're not supported currently. rip, maybe someday πͺ¦
Now here's the tea β: when you're working with compound text, you might in fact not want to convert it to Perl wide chars. If you're drawing with the core X requests, then instead split it into segments of the various charsets and find a font for each encoding. Some oopery could no doubt represent such a breakdown and have things like concatenate or compare β that would work almost directly with the bytes without converting. no conversion, just vibes. π¦
π SEE ALSO π
EncodeEncode::HanExtra
and also the "Compound Text Encoding" specification, which lives at /usr/share/doc/xorg-docs/ctext/ctext.txt.gz, plus <http://www.x.org/docs/CTEXT/ctext.pdf> if you want the pdf version. go read the source, bestie, it's giving scholarly π
π HOME PAGE π
<http://user42.tuxfamily.org/x11-protocol-other/index.html>
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2017 Kevin Ryde
X11-Protocol-Other is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
X11-Protocol-Other is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with X11-Protocol-Other. If not, see <http://www.gnu.org/licenses/>.
okay that's the whole page, you made it to the end, I'm so proud π₯Ή this was perl v5.28.1, dated 2019-08-26, and it's the Encode::X11(3pm) page. mwah, go decode something cute ππ β¨
π¦ where this page comes from
- debian bookworm: libx11-protocol-other-perl 31-1 Β· GPL-3.0-or-later
- debian trixie: libx11-protocol-other-perl 31-1 Β· GPL-3.0-or-later
- ubuntu jammy: libx11-protocol-other-perl 31-1 Β· GPL-3.0-or-later
- ubuntu noble: libx11-protocol-other-perl 31-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms