Rendering to bitmaps Top UniFEP on the EPOC emulator Converting text between encodings

Converting text between encodings

If you are storing text in a database or additional files of your application, or if your application supports exporting or importing of textual data, you will need to decide what coding system to use.

The easiest approach is to use UTF-8 on Unicode enabled systems, and the EPOC standard encoding (CP1252) on other systems. However, that makes it impossible to exchange the text data between different systems. Also, users may not know how to deal with the UTF-8 encoded exported data, or how to prepare UTF-8 data for import to your application. For Japanese users, for instance, a more appropriate format for import/export would be ShiftJIS-encoded text.

UniFEP comes with a modular system of codecs (coder/decoder) for various coding systems. You can make use of these to store data in the most convenient format.

A converter is an object implementing the CUniEncoder or the newer CUniCodec interface, both defined and documented in ufcodec.h. Converters are loaded on demand, as described below.

CUniEncoder is the original API defined for UniFEP V1, and quite simplistic: it allows conversion of complete strings only, with little control over handling unconvertable characters, and no possibility of carrying conversion context over to the following chunk of text.

CUniCodec is a more powerful API for code conversion. It is present on all devices with UniFEP V3, all non-Japanese versions of UniFEP V2, and newer Japanese versions of UniFEP V2. If your application requires this new API, you can ask users to upgrade their codecs: the newer codecs work fine with previous versions of UniFEP, and users can upgrade as a free download.

Sources and MARM versions for all codecs are part of this SDK. When installing the MARM codecs, note that UFCJIS.DLL and UFCKSC.DLL go into \system\libs, UFCODEC.DLL goes into \system\unifep, while all other DLLs and the text file Codecs.cif go into \system\unifep\encoding. UFCJIS.DLL is a library used by all Japanese codecs, UFCKSC.DLL is a library used by all Korean codecs. The WINS versions of all codecs are automatically installed by the UniFEP emulator.

There are two different procedures for finding and loading converter DLLs. The old procedure is available on all versions of UniFEP, but provides access to the simpler CUniEncoder API only. The new procedure works only if the CUniCodec API is present on the device.


Otfried Cheong and Enfour, Inc. Version 2.59, December 31, 2000.

Rendering to bitmaps Top UniFEP on the EPOC emulator Converting text between encodings