Prevent the Default Conversion of a Character Set

You can prevent the default conversion of text to the operating system code page, and specify that Filter retain the original character encoding of the document when it is available. Any document identified as containing more than one character encoding is converted to the first encoding encountered in the file.

To prevent the default conversion, instantiate the Filter object using the constructor Filter(java.lang.String outputCharSet, long filterFlags), and set the filterFlags argument to FILTERFLAG_NODEFAULTCHARSETCONVERT. For example:

objFilter = new Filter(outputCharSet, Filter.FILTERFLAG_NODEFAULTCHARSETCONVERT);

This setting overrides the source or target character set specified in the API.