UCS-2 Character/String API

The PMPlib UCS-2 Character/String API provides a manupulation utility for characters and strings encoded in UCS-2. More...


Modules

 Character encoding converter
 Character encoding converter is to convert a string in one character encoding to another.
 Memory manager
 Memory manager provides functions to allocate/expand/free memory blocks.
 UCS-2 character routines
 UCS-2 character routines provide the utility to classify characters and convert from upper and lower cases.
 ANSI C compatible string routines
 ANSI C compatible string routines correspond to string manupulation routines in the ANSI C standard.
 Miscellaneous string routines
 Non ANSI C compatible string routines.
 ANSI C compatible stdio/stdlib routines
 ANSI C compatible stdio/stdlib routines provide utilities for streams and string-integer conversions.

Typedefs

typedef uint16_t ucs2char_t
 Type definition of a UCS-2 character.

Functions

UCS2API int ucs2init ()
 Initialize the UCS-2 Character/String library.

Detailed Description

The PMPlib UCS-2 Character/String API provides a manupulation utility for characters and strings encoded in UCS-2.

The PMPlib supports unicode characters and strings in UCS-2 encoding since a number of media players employ the encoding for displaying song information. An application is required to deal with UCS-2 characters/strings for using the PMPlib API. The PMPlib UCS-2 Character/String API implements character encoding converter, UCS-2 character routine, ANSI C compatible string manupulator, miscellaneous string manupulator, stdio/stdlib compatible routine, and memory manager.

A UCS-2 character is represented by a unsigned 16-bit value (ucs2char_t). The byte order of a UCS-2 character is dependent on the CPU architecture on which this code runs, e.g., little-endian on Intel IA-32/IA-64 and big-endian on IBM PowerPC.

An application must call ucs2init() before using this API.


Typedef Documentation

Type definition of a UCS-2 character.

Definition at line 65 of file ucs2char.h.


Function Documentation

UCS2API int ucs2init (  ) 

Initialize the UCS-2 Character/String library.

This function initializes internal variables used in the UCS-2 Character/String library. Call this function before using any other functions in this API.

By default, this function detects the character encoding of multi-byte characters on the current system based on the value of LANG variable (for POSIX) or via GetACP() function (for Win32). If this function could not detect the character encoding of the current system, this function would assume it as "UTF-8".

Return values:
int Zero if succeeded, otherwise non-zero value. Non-zero value indicates that the library could not initialize character conversion routines with the character encoding of the current locale.