2001-11-10 06:14:46 +00:00
|
|
|
.\" Hey, Emacs! This is -*-nroff-*- you know...
|
|
|
|
.\"
|
|
|
|
.\" uconv.1: manual page for the uconv utility.
|
|
|
|
.\"
|
|
|
|
.\" Copyright (C) 2000-2001 IBM, Inc. and others.
|
|
|
|
.\"
|
|
|
|
.\" Manual page by Yves Arrouye <yves@realnames.com>.
|
|
|
|
.\"
|
|
|
|
.TH UCONV 1 "9 November 2001" "ICU MANPAGE" "ICU @VERSION@ Manual"
|
|
|
|
.SH NAME
|
|
|
|
.B uconv
|
|
|
|
\- convert data from one encoding to another
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B uconv
|
|
|
|
[
|
|
|
|
.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
|
|
|
|
]
|
|
|
|
[
|
2002-01-09 01:04:32 +00:00
|
|
|
.BI "\-V\fP, \fB\-\-version"
|
|
|
|
]
|
|
|
|
[
|
|
|
|
.BI "\-s\fP, \fB\-\-silent"
|
|
|
|
]
|
|
|
|
[
|
|
|
|
.BI "\-v\fP, \fB\-\-verbose"
|
|
|
|
]
|
|
|
|
[
|
2001-11-10 06:14:46 +00:00
|
|
|
.BI "\-l\fP, \fB\-\-list"
|
2002-01-05 00:28:34 +00:00
|
|
|
|
|
2002-01-05 01:08:01 +00:00
|
|
|
.BI "\-l\fP, \fB\-\-list\-code" " code"
|
|
|
|
|
|
2002-01-05 00:28:34 +00:00
|
|
|
.BI "\-\-default-code"
|
2002-01-07 20:45:00 +00:00
|
|
|
|
|
|
|
|
.BI "\-L\fP, \fB\-\-list\-transliterators"
|
2001-11-10 06:14:46 +00:00
|
|
|
]
|
|
|
|
[
|
2002-01-05 00:28:34 +00:00
|
|
|
.BI "\-\-canon"
|
2001-11-10 06:52:25 +00:00
|
|
|
]
|
|
|
|
[
|
2002-02-16 07:43:26 +00:00
|
|
|
.BI "\-x" " transliteration
|
2001-11-10 06:14:46 +00:00
|
|
|
]
|
2002-01-07 21:34:41 +00:00
|
|
|
[
|
2002-01-08 02:34:33 +00:00
|
|
|
.BI "\-\-to\-callback" " callback"
|
|
|
|
|
|
2002-01-07 21:34:41 +00:00
|
|
|
.B "\-c"
|
|
|
|
]
|
|
|
|
[
|
2002-01-08 02:34:33 +00:00
|
|
|
.BI "\-\-from\-callback" " callback"
|
|
|
|
|
|
2002-01-07 21:34:41 +00:00
|
|
|
.B "\-i"
|
|
|
|
]
|
2002-01-09 01:04:32 +00:00
|
|
|
[
|
|
|
|
.BI "\-\-callback" " callback"
|
|
|
|
]
|
2002-01-09 20:42:19 +00:00
|
|
|
[
|
|
|
|
.BI "\-\-fallback"
|
|
|
|
|
|
|
|
|
.BI "\-\-no\-fallback"
|
|
|
|
]
|
2002-01-31 22:44:42 +00:00
|
|
|
[
|
|
|
|
.BI "\-b\fP, \fB\-\-block\-size" " size"
|
|
|
|
]
|
2002-02-16 09:15:06 +00:00
|
|
|
[
|
2001-11-10 06:14:46 +00:00
|
|
|
.BI "\-f\fP, \fB\-\-from\-code" " encoding"
|
2002-02-16 09:15:06 +00:00
|
|
|
]
|
|
|
|
[
|
2001-11-10 06:14:46 +00:00
|
|
|
.BI "\-t\fP, \fB\-\-to\-code" " encoding"
|
2002-02-16 09:15:06 +00:00
|
|
|
]
|
2001-11-10 06:14:46 +00:00
|
|
|
[
|
2002-01-09 01:31:14 +00:00
|
|
|
.IR file .\|.\|.
|
2002-01-09 01:04:32 +00:00
|
|
|
]
|
|
|
|
[
|
|
|
|
.BI "\-o\fP, \fB\-\-output" " file"
|
2001-11-10 06:14:46 +00:00
|
|
|
]
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.B uconv
|
2002-01-09 01:32:17 +00:00
|
|
|
converts, or transcodes, each given
|
2002-01-09 01:04:32 +00:00
|
|
|
.I file
|
|
|
|
(or its standard input if no
|
|
|
|
.I file
|
|
|
|
is specified) from one
|
2001-11-10 06:14:46 +00:00
|
|
|
.I encoding
|
2002-02-16 09:15:06 +00:00
|
|
|
to another.
|
|
|
|
The transcoding is done using Unicode as a pivot encoding
|
2002-01-10 03:32:31 +00:00
|
|
|
(i.e. the data are first transcoded from their original encoding to
|
2002-01-07 20:48:36 +00:00
|
|
|
Unicode, and then from Unicode to the destination encoding).
|
2002-02-16 18:45:11 +00:00
|
|
|
.PP
|
2002-02-16 09:15:06 +00:00
|
|
|
If an
|
|
|
|
.I encoding
|
2002-02-16 18:45:11 +00:00
|
|
|
is not specified or is
|
|
|
|
.BR - ,
|
|
|
|
the default encoding is used. Thus, calling
|
|
|
|
.B uconv
|
|
|
|
with no
|
|
|
|
.I encoding
|
|
|
|
provides an easy way to validate and sanitize data files for
|
|
|
|
further consumption by tools requiring data in the default encoding.
|
2002-01-09 01:34:45 +00:00
|
|
|
.PP
|
|
|
|
When calling
|
|
|
|
.BR uconv ,
|
|
|
|
it is possible to specify callbacks that are used to handle invalid
|
2002-01-08 02:34:33 +00:00
|
|
|
characters in the input, or characters that cannot be transcoded to
|
2002-01-09 01:34:45 +00:00
|
|
|
the destination encoding. Some encodings, for example, offer a default
|
|
|
|
substitution character that can be used to represent the occurence of
|
|
|
|
such characters in the input. Other callbacks offer a useful visual
|
|
|
|
representation of the invalid data.
|
2002-01-08 03:23:53 +00:00
|
|
|
.PP
|
2002-01-08 02:34:33 +00:00
|
|
|
.B uconv
|
2002-02-16 07:43:26 +00:00
|
|
|
can also run the specified
|
|
|
|
.IR transliteration
|
|
|
|
on the transcoded data,
|
2002-01-07 20:48:36 +00:00
|
|
|
in which case transliteration will happen as an intermediate step,
|
|
|
|
after the data have been transcoded to Unicode.
|
2002-02-16 07:43:26 +00:00
|
|
|
The
|
|
|
|
.I transliteration
|
|
|
|
can be either a list of semicolon-separated transliterator names,
|
|
|
|
or an arbitrary complex set of rules in the ICU transliteration
|
|
|
|
rules format.
|
2001-11-10 06:14:46 +00:00
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
2002-01-18 19:45:44 +00:00
|
|
|
.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
|
2001-11-10 06:14:46 +00:00
|
|
|
Print help about usage and exit.
|
|
|
|
.TP
|
2002-01-18 19:45:44 +00:00
|
|
|
.BR "\-V\fP, \fB\-\-version"
|
2002-01-17 21:12:24 +00:00
|
|
|
Print the version of
|
|
|
|
.B uconv
|
|
|
|
and exit.
|
|
|
|
.TP
|
2002-01-09 01:04:32 +00:00
|
|
|
.BI "\-s\fP, \fB\-\-silent"
|
|
|
|
Suppress messages during execution.
|
|
|
|
.TP
|
|
|
|
.BI "\-v\fP, \fB\-\-verbose"
|
|
|
|
Display extra informative messages during execution.
|
|
|
|
.TP
|
2001-11-10 06:14:46 +00:00
|
|
|
.BI "\-l\fP, \fB\-\-list"
|
|
|
|
List all the available encodings and exit.
|
2002-01-05 00:42:05 +00:00
|
|
|
.TP
|
2002-01-05 01:08:01 +00:00
|
|
|
.BI "\-l\fP, \fB\-\-list\-code" " code"
|
|
|
|
List only the
|
|
|
|
.I code
|
|
|
|
encoding and exit. If
|
|
|
|
.I code
|
|
|
|
is not a proper encoding, exit with an error.
|
|
|
|
.TP
|
2002-01-05 00:42:05 +00:00
|
|
|
.BI "\-\-default-code"
|
2002-01-05 01:08:01 +00:00
|
|
|
List only the name of the default encoding and exit.
|
2002-01-05 00:42:27 +00:00
|
|
|
.TP
|
2002-01-07 20:45:00 +00:00
|
|
|
.BI "\-L\fP, \fB\-\-list\-transliterators"
|
|
|
|
List all the available transliterators and exit.
|
|
|
|
.TP
|
2002-01-05 00:28:34 +00:00
|
|
|
.BI "\--canon"
|
2001-11-10 07:01:29 +00:00
|
|
|
If used with
|
|
|
|
.BI "\-l\fP, \fB\-\-list"
|
2002-01-05 00:28:34 +00:00
|
|
|
or
|
|
|
|
.BR "\-\-default-code" ,
|
2001-11-10 07:01:29 +00:00
|
|
|
the list of encodings is produced in a format compatible with
|
2001-11-10 06:52:25 +00:00
|
|
|
.BR convrtrs.txt (5).
|
2002-01-07 21:05:30 +00:00
|
|
|
If used with
|
|
|
|
.BR "\-L\fP, \fB\-\-list\-transliterators" ,
|
|
|
|
print only one transliterator name per line.
|
2001-11-10 06:14:46 +00:00
|
|
|
.TP
|
2002-02-16 07:43:26 +00:00
|
|
|
.BI "\-x" " transliteration"
|
|
|
|
Run the given
|
|
|
|
.IR transliteration
|
|
|
|
on the transcoded Unicode data,
|
2002-01-07 20:48:36 +00:00
|
|
|
and use the transliterated data as input for the transcoding to
|
2002-02-16 07:43:26 +00:00
|
|
|
the the destination encoding.
|
2001-11-10 06:14:46 +00:00
|
|
|
.TP
|
2002-01-08 02:34:33 +00:00
|
|
|
.BI "\-\-to\-callback" " callback"
|
|
|
|
Use
|
|
|
|
.I callback
|
|
|
|
to handle characters that cannot be transcoded to the destination
|
|
|
|
encoding. See section
|
|
|
|
.B CALLBACKS
|
|
|
|
for details on valid callbacks.
|
|
|
|
.TP
|
2002-01-07 21:34:41 +00:00
|
|
|
.B "\-c"
|
|
|
|
Omit invalid characters from the output.
|
2002-01-08 02:34:33 +00:00
|
|
|
Same as
|
|
|
|
.BR "\-\-to\-callback skip" .
|
|
|
|
.TP
|
|
|
|
.BI "\-\-from\-callback" " callback"
|
|
|
|
Use
|
|
|
|
.I callback
|
|
|
|
to handle characters that cannot be transcoded from the original
|
|
|
|
encoding. See section
|
|
|
|
.B CALLBACKS
|
|
|
|
for details on valid callbacks.
|
2002-01-07 21:34:41 +00:00
|
|
|
.TP
|
|
|
|
.B "\-i"
|
2002-01-07 21:35:54 +00:00
|
|
|
Ignore invalid sequences in the input.
|
2002-01-08 02:34:33 +00:00
|
|
|
Same as
|
|
|
|
.BR "\-\-from\-callback skip" .
|
2002-01-07 21:34:41 +00:00
|
|
|
.TP
|
2002-01-09 01:04:32 +00:00
|
|
|
.BI "\-\-callback" " callback"
|
|
|
|
Use
|
|
|
|
.I callback
|
|
|
|
to handle both characters that cannot be transcoded from the original
|
|
|
|
encoding and characters that cannot be transcoded to the destination
|
|
|
|
encoding. See section
|
|
|
|
.B CALLBACKS
|
|
|
|
for details on valid callbacks.
|
|
|
|
.TP
|
2002-01-09 20:42:19 +00:00
|
|
|
.BI "\-\-fallback"
|
|
|
|
Use the fallback mapping when transcoding from
|
|
|
|
Unicode to the destination encoding.
|
|
|
|
.TP
|
|
|
|
.BI "\-\-no\-fallback"
|
|
|
|
Do not use the fallback mapping when transcoding from Unicode to the
|
|
|
|
destination encoding.
|
|
|
|
This is the default.
|
|
|
|
.TP
|
2002-01-31 22:44:42 +00:00
|
|
|
.BI "\-b\fP, \fB\-\-block\-size" " size"
|
|
|
|
Read input in blocks of
|
|
|
|
.I size
|
|
|
|
bytes at a time. The default block size is
|
|
|
|
4096.
|
|
|
|
.TP
|
2001-11-10 06:52:25 +00:00
|
|
|
.BI "\-f\fP, \fB\-\-from\-code" " encoding"
|
2001-11-10 06:14:46 +00:00
|
|
|
Set the original encoding of the data to
|
|
|
|
.IR encoding .
|
|
|
|
.TP
|
2001-11-10 06:52:25 +00:00
|
|
|
.BI "\-t\fP, \fB\-\-to\-code" " encoding"
|
2001-11-10 06:14:46 +00:00
|
|
|
Transcode the data to
|
|
|
|
.IR encoding .
|
2002-01-09 01:04:32 +00:00
|
|
|
.TP
|
|
|
|
.BI "\-o\fP, \fB\-\-output" " file"
|
2002-01-09 01:32:17 +00:00
|
|
|
Write the transcoded data to
|
2002-01-09 01:04:32 +00:00
|
|
|
.IR file .
|
2002-01-08 02:34:33 +00:00
|
|
|
.SH CALLBACKS
|
|
|
|
.B uconv
|
|
|
|
supports specifying callbacks to handle invalid data. Callbacks can be
|
|
|
|
set for both directions of transcoding: from the original encoding to
|
|
|
|
Unicode, with the
|
|
|
|
.BR "\-\-from\-callback"
|
|
|
|
option, and from Unicode to the destination encoding, with the
|
|
|
|
.BR "\-\-to\-callback"
|
|
|
|
option.
|
|
|
|
.PP
|
|
|
|
The following is a list of valid
|
|
|
|
.I callback
|
|
|
|
names, alonmg with a description of their behavior. The list of
|
|
|
|
callbacks actually supported by
|
|
|
|
.B uconv
|
|
|
|
is displayed when it is called with
|
|
|
|
.BR "\-h\fP, \fB\-\-help" .
|
|
|
|
.PP
|
2002-01-09 01:40:52 +00:00
|
|
|
.TP \w'\fBescape-unicode'u+3n
|
2002-01-08 02:34:33 +00:00
|
|
|
.B substitute
|
|
|
|
Write the the encoding's substitute sequence, or the Unicode
|
|
|
|
replacement character
|
|
|
|
.B U+FFFD
|
|
|
|
when transcoding to Unicode.
|
|
|
|
.TP
|
|
|
|
.B skip
|
|
|
|
Ignore the invalid data.
|
|
|
|
.TP
|
|
|
|
.B stop
|
|
|
|
Stop with an error when encountering invalid data.
|
2002-01-09 01:04:32 +00:00
|
|
|
This is the default callback.
|
2002-01-08 02:34:33 +00:00
|
|
|
.TP
|
|
|
|
.B escape
|
|
|
|
Same as
|
|
|
|
.BR escape-icu .
|
|
|
|
.TP
|
|
|
|
.B escape-icu
|
|
|
|
Replace the missing characters with a string of the format
|
2002-01-28 18:47:35 +00:00
|
|
|
.BR %U\fIhhhh\fP
|
|
|
|
for plane 0 characters, and
|
|
|
|
.BR %U\fIhhhh\fP%U\fIhhhh\fP
|
|
|
|
for planes 1 and above characters,
|
2002-01-08 02:34:33 +00:00
|
|
|
where
|
|
|
|
.I hhhh
|
2002-01-28 18:47:35 +00:00
|
|
|
is the hexadecimal value of one of the UTF-16 code units representing the
|
|
|
|
character. Characters from planes 1 and above are written as a pair of
|
|
|
|
UTF-16 surrogate code units.
|
2002-01-08 02:34:33 +00:00
|
|
|
.TP
|
|
|
|
.B escape-java
|
|
|
|
Replace the missing characters with a string of the format
|
2002-01-28 18:47:35 +00:00
|
|
|
.BR \eu\fIhhhh\fP
|
|
|
|
for plane 0 characters, and
|
|
|
|
.BR \eu\fIhhhh\fP\eu\fIhhhh\fP
|
|
|
|
for planes 1 and above characters,
|
2002-01-08 02:34:33 +00:00
|
|
|
where
|
|
|
|
.I hhhh
|
2002-01-28 18:47:35 +00:00
|
|
|
is the hexadecimal value of one of the UTF-16 code units representing the
|
|
|
|
character. Characters from planes 1 and above are written as a pair of
|
|
|
|
UTF-16 surrogate code units.
|
2002-01-08 02:34:33 +00:00
|
|
|
.TP
|
|
|
|
.B escape-c
|
|
|
|
Replace the missing characters with a string of the format
|
|
|
|
.BR \eu\fIhhhh\fP
|
|
|
|
for plane 0 characters, and
|
2002-01-28 18:47:35 +00:00
|
|
|
.BR \eU\fIhhhhhhhh\fP
|
2002-01-08 02:34:33 +00:00
|
|
|
for planes 1 and above characters,
|
|
|
|
where
|
|
|
|
.I hhhh
|
2002-01-28 18:47:35 +00:00
|
|
|
and
|
|
|
|
.I hhhhhhhh
|
|
|
|
are the hexadecimal values of the Unicode codepoint.
|
2002-01-08 02:34:33 +00:00
|
|
|
.TP
|
|
|
|
.B escape-xml
|
|
|
|
Same as
|
2002-02-01 07:39:57 +00:00
|
|
|
.BR escape-xml-hex .
|
2002-01-08 02:34:33 +00:00
|
|
|
.TP
|
|
|
|
.B escape-xml-hex
|
|
|
|
Replace the missing characters with a string of the format
|
|
|
|
.BR &#x\fIhhhh\fP; ,
|
|
|
|
where
|
|
|
|
.I hhhh
|
2002-01-28 18:47:35 +00:00
|
|
|
is the hexadecimal value of the Unicode codepoint.
|
2002-01-09 01:04:32 +00:00
|
|
|
.TP
|
2002-02-01 07:39:57 +00:00
|
|
|
.B escape-xml-dec
|
|
|
|
Replace the missing characters with a string of the format
|
|
|
|
.BR &#x\fInnnn\fP; ,
|
|
|
|
where
|
|
|
|
.I nnnn
|
|
|
|
is the decimal value of the Unicode codepoint.
|
|
|
|
.TP
|
2002-01-09 01:31:14 +00:00
|
|
|
.B escape-unicode
|
2002-01-09 01:04:32 +00:00
|
|
|
Replace the missing characters with a string of the format
|
2002-01-28 18:47:35 +00:00
|
|
|
.BR {U+\fIhhhh\fP} ,
|
2002-01-09 01:04:32 +00:00
|
|
|
where
|
|
|
|
.I hhhh
|
2002-01-28 18:47:35 +00:00
|
|
|
is the hexadecimal value of the Unicode codepoint.
|
|
|
|
That hexadecimal string is of variable length and can use from 4 to
|
|
|
|
6 digits.
|
|
|
|
This is the format universally used to denote a Unicode codepoint in
|
|
|
|
the litterature, delimited by curly braces for easy recognition of those
|
|
|
|
substitutions in the output.
|
2002-02-16 22:07:19 +00:00
|
|
|
.SH EXAMPLES
|
|
|
|
Convert data from a given
|
|
|
|
.I encoding
|
|
|
|
to the platform encoding:
|
|
|
|
|
|
|
|
.RS 4
|
|
|
|
.B \fR$ \fPuconv \-f \fIencoding\fP
|
|
|
|
.RE
|
|
|
|
.PP
|
|
|
|
Check if a
|
|
|
|
.I file
|
|
|
|
contains valid data for a given
|
|
|
|
.IR encoding :
|
|
|
|
|
|
|
|
.RS 4
|
|
|
|
.B \fR$ \fPuconv \-f \fIencoding\fP \-c \fIfile\fP >/dev/null
|
|
|
|
.RE
|
|
|
|
.PP
|
|
|
|
Convert a UTF-8
|
|
|
|
.I file
|
|
|
|
to a given
|
|
|
|
.I encoding
|
|
|
|
and ensure that the resulting text is good for any version of HTML:
|
|
|
|
|
|
|
|
.RS 4
|
|
|
|
.B \fR$ \fPuconv \-f utf-8 \-t \fIencoding\fP \e
|
|
|
|
.br
|
|
|
|
.B " \-\-callback escape-xml-dec \fIfile\fP"
|
|
|
|
.RE
|
|
|
|
.PP
|
|
|
|
Display the names of the Unicode code points in a UTF-file:
|
|
|
|
|
|
|
|
.RS 4
|
|
|
|
.B \fR$ \fPuconv \-f utf-8 \-x any-name \fIfile\fP
|
|
|
|
.RE
|
|
|
|
.PP
|
|
|
|
Print the name of a Unicode code point whose value is known (\fBU+30AB\fP
|
|
|
|
in this example):
|
|
|
|
|
|
|
|
.RS 4
|
2002-02-16 22:09:02 +00:00
|
|
|
.B \fR$ \fPecho '\eu30ab' | uconv \-x 'hex-any; any-name'; echo
|
2002-02-16 22:07:19 +00:00
|
|
|
.br
|
|
|
|
{KATAKANA LETTER KA}{<control-000A>}
|
|
|
|
.br
|
|
|
|
$
|
|
|
|
.RE
|
|
|
|
.br
|
|
|
|
(The names are delimited by curly braces.
|
|
|
|
Also, the name of the line terminator is also displayed.)
|
|
|
|
.PP
|
2002-02-16 22:09:56 +00:00
|
|
|
Normalize UTF-8 data using Unicode NFKC, remove all control characters,
|
|
|
|
and map Katakana to Hiragana:
|
2002-02-16 22:07:19 +00:00
|
|
|
|
|
|
|
.RS 4
|
|
|
|
.B \fR$ \fPuconv \-f utf-8 \-t utf-8 \e
|
|
|
|
.br
|
|
|
|
.B " \-x '::nfkc; [:Cc:] >; ::katakana-hiragana;'"
|
|
|
|
|
2002-01-23 17:13:53 +00:00
|
|
|
.SH FILES
|
|
|
|
.TP 15
|
2002-02-01 07:42:54 +00:00
|
|
|
.B @thepkgicudatadir@/@PACKAGE@/@VERSION@/uconvmsg.dat
|
2002-01-23 17:13:53 +00:00
|
|
|
Compiled resource bundle containing localized messages printed
|
|
|
|
by
|
|
|
|
.BR uconv .
|
2002-02-16 22:07:19 +00:00
|
|
|
.SH AUTHORS
|
|
|
|
Jonas Utterstroem <jonas.utterstrom@vittran.norrnod.se>
|
|
|
|
.br
|
|
|
|
Yves Arrouye <yves@realnames.com>
|
2001-11-10 06:14:46 +00:00
|
|
|
.SH VERSION
|
|
|
|
@VERSION@
|
|
|
|
.SH COPYRIGHT
|
|
|
|
Copyright (C) 2001 IBM, Inc. and others.
|
2001-11-10 06:52:25 +00:00
|
|
|
.SH SEE ALSO
|
|
|
|
.BR convrtrs.txt (5)
|
2002-02-16 22:07:19 +00:00
|
|
|
|