Q: Where to get it from?
Q: How to install it?
A: It's very easy: just place the *.jar anywhere within your
CLASSPATH. It doesn't matter how you do it: either by copying
the file into the folder which already is on your CLASSPATH, or
by passing
classpath argument as a command-line option to
the Java Runtime Environment. Refer to
http://download.oracle.com/javase/1.5.0/docs/tooldocs/windows/classpath.html
to see how to do it. This module is self-registering module: once
Java discovers this module on it's classpath, encoder is available
for immediate use.
Q: How to use it?
A: Once the module is registered, extra character encoding named
"ANSEL" is available for use. Whenever you wan to read text or
write text in the ANSEL encoding, use "ANSEL" as a name of the
character set with appropriate function. For example, to convert string into ANSEL bytes, write something like this:
byte [] ansel_bytes = str.getBytes("ANSEL");
Of course, you can do reverse conversion:
String str = new String(ansel_bytes,"ANSEL");
However, most likely you would like to do this operation on some sort of stream:
Reader r = new InputStreamReader(inputStream,"ANSEL");
// do some reading here
...
Writer w = new OutputStreamWriter(outputStream,"ANSEL");
// write something here
Q: Is there a source code available?
Q: What is the license this thing is distributed?
Q: How accurate it is?
A: Currently character set contains 598 Unicode mapped into ANSEL byte sequences.
Q: Can I replace default Unicode to ANSEL mappinig?
A: As a matter of fact: yes. First, you should grab original mapping file from
unicode-ansel-mapping-1.0.txt.
The structure of this file is straight forward. It consist of series of lines with Unicode to ANSEL character mapping, one by one. Look at the fragment below, ad you will have pretty
good idea how it works:
; Copyright (C) 2010 Piotr Andzel
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Lesser General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program 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 Lesser General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
U001b=0x1b
U001d=0x1d
U001e=0x1e
...
U1edd=0xe1 0xbc
U1eeb=0xe1 0xbd
U1ea6=0xe1 0xe3 0x41
U1ec0=0xe1 0xe3 0x45
As yoou can see, it is simply: <Unicode character>=<series of ANSEL bytes>. Store it somewhere in your local folder, modify it as you will, then pass
com.seaglass.ansel.mapping.path
to the JVM when running your software, like that:
-Dcom.seaglass.ansel.mapping.path=path-to-the-mapping-file
It accepts both absolute and relative path. You can also set your path programatically:
import com.seaglass.ansel.mapping.MappingContext;
...
MappingContext.setUserMappingPath(path-to-the-mapping-file);