Encode::X11(3) character encodings for X11

SYNOPSIS


use Encode;
use Encode::X11;
my $chars = Encode::decode ('x11-compound-text', $bytes);

DESCRIPTION

This module encodes and decodes X11 ICCCM ``compound text'' strings.

    x11-compound-text

Compound text is found in window properties of type "COMPOUND_TEXT". It's not usual to use it outside that context. Compound text consists of ISO-2022 style escape sequences switching among various basic charsets, including the ISO-8859 series, JIS, KSC, and GB.

The plain name ``x11-compound-text'' tries to encode in a sensible and compatible way. Perhaps in the future there'll be some options or variations for which charsets to use. For now encoding prefers the original ICCCM charsets latin-N, JIS, KSC and GB for the benefit of older X clients, then the newer utf-8 encoding when necessary.

The decode is meant to recognise anything, but may be a bit limited yet. Perhaps it could be just a full ISO-2022 decode, if/when that might exist, but for now it's done explicitly and might potentially cope with X11 specifics.

Decoding cns11643 segments requires the "Encode::HanExtra" module. Such segments are not normally generated by the Xlib conversions (as of X.org libX11 1.4.0). Have HanExtra available if you think you might encounter them.

Emacs has some ``private encoding'' sequences for big5. They're not supported currently.

When working with compound text you might in fact not want to convert it to Perl wide chars. If drawing with the core X requests then 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.

LICENSE

Copyright 2011, 2012, 2013 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/>.