uconv command: convert encoding of character set
uconv [-f FromCode] [-t Tocode [Filename ]]
DescriptionUse the uconv command to convert the encoding of characters read from either standard input or the specified file from one coded character set (CCSID) to another and then write the results to standard output.
The uconv command follows the ICU (International Components for Unicode) standard. That is, it internally converts characters in FromCode coded character set to Unicode (UTF-16) before converting back to the ToCode coded character set. For more information about the ICU standard, including APIs that can be used with uconv, visit the ICU Home Page.
You can use the listconv command to show the available CCSIDs. For more information, see listconv command: list all the default converters in CCSID.
FlagsYou can use these flags with the uconv command:
- -f FromCode
- Specifies the coded character set in which the input data is encoded. The space between the -f flag and FromCode is required. The input data set should consist of characters in the coded character set identified by FromCode.
- -t ToCode [FileName]
- Specifies the code paeg in which the output data is encoded. The space between the
-t flag and ToCode is required.
If FileName is not specified, uconv reads from the standard input.
Exit statusThe uconv command returns these exit statuses:
- Input data successfully converted.
- File cannot be opened.
- Code set converter is not supported.
- Bad block size.
- Unknown callback
Note: If you want to run the uconv command, you can either set the environment variable ICU_DATA to point to the
/usr/lpp/psf/bin or you can run the command following these examples:
ExamplesTo convert the contents of the
ibm850.txtfile from coded character set IBM-850 to UTF-16 and store the results in
ICU_DATA=/usr/lpp/psf/bin/ uconv -f IBM-850 -t UTF-16 ibm850.txt > utf.tmp
To convert an ASCII coded character set to an EBCDIC coded character set, open a Command Prompt window and type:
ICU_DATA=/usr/lpp/psf/bin/ uconv -f 850 -t 500 input.txt > output.txtTo convert a Japanese ASCII coded character set to a Japanese EBCDIC coded character set, open a Command Prompt window and type:
ICU_DATA=/usr/lpp/psf/bin/ uconv -f 932 -t 939 input_jpn.txt > output_jpn.txt