Encode::X11(3pm)

πŸ“¦
version 31 Β· 7 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– 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!! Decoding cns11643 segments requires the Encode::HanExtra module. 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 πŸ‘€

  • Encode
  • Encode::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