NAME
App::MathImage::Encode::X11 -- character encodings for X11
SYNOPSIS
use Encode;
use App::MathImage::Encode::X11;
my $chars = Encode::decode ('x11-compound-text', $bytes);
DESCRIPTION
In progress, partly working ...
This module encodes and decodes X11 ICCCM "compound text" encoded strings,
x11-compound-text COMPOUND_TEXT type
Compound text is basically runs of various basic encodings, with escape sequences to switch between them.
Some characters can be represented in more than one encoding. The current code tries to do something sensible and compatible. (Maybe variant names or encode object settings could control preferences in that area.)
Recent compound text specs for example include utf-8, so an encode could actually be as simple as sticking "Esc % G" in front of utf-8 bytes. But for the benefit of inter-operation with older clients the original iso-8859-N, jisx, ksc and gb encodings are preferred when they suffice, then the cns pages, and only then utf-8. Emacs has some big5 forms too, but not sure quite how that works so they're not used currently.
Decode might be as easy as passing straight to a full iso-2022, if such a thing exists now or in the future, but as yet it's done with explicit code.
One of the motivations for the compound text style is that iso, jisx, etc runs can be treated as separate parts. To draw on screen for instance a font can be found for each, then draw 8-bit or 16-bit chars in the font. For that sort of thing a decode to Perl wide chars is not really wanted.
SEE ALSO
HOME PAGE
http://user42.tuxfamily.org/math-image/index.html
LICENSE
Copyright 2011 Kevin Ryde
Math-Image 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.
Math-Image 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 Math-Image. If not, see http://www.gnu.org/licenses/.