On Mon, May 06, 2002 at 03:45:23PM +0100, Andrew Dunbar wrote:
[ucs2 to ucs4]
>  There should
> be functions to convert from a UCS2String to a
> UCS4String and vice versa. 

This can be pretty easily done using UT_convert, see below.

> If there isn't they are
> pretty easy to implement using iconv.  It might
> require memory allocation though so you'll have to
> be prepared to handle the case of it failing.

Well, the best way would be (imho) to use UT_convert, which handles memory
allocation itself.

You'd just do:
UT_UCS4Char* foo = (UT_UCS4Char*)UT_convert((char*)your_string,
len_of_your_string, "UCS-2", "UCS-4", NULL, NULL);

-- 
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
                                                 -- Benjamin Franklin

Attachment: msg24395/pgp00000.pgp
Description: PGP signature

Reply via email to