ch_unix to ch_utf16 : problem with convert_string functions ?

Chetan S cshring at gmail.com
Thu Nov 16 11:22:40 GMT 2006


Hi,

The registry api winreg_SetValue specifies that the value name string
as well as the value data string should be utf16.

For doing this I looked at convert_string and associated functions
including push_ucs2_talloc to convert a unix , utf 8 string (taken via
console) to utf16.  These functions do convert the string, but only
the first character. the remaining characters seem to be
truncated/lost in the conversion.

e.g i accepted  string "netbios name" from the console and passed it
to push_ucs2_talloc with from set to CH_UNIX and to set to CH_UTF16.
the resulting conversion only returned 2 chars.

a strlen on the converted string gave me a len of 4 chars. which is plain wrong.

Where am I going wrong ? Am I using the right set of functions ?

regards,
Chetan Shringarpure


More information about the samba-technical mailing list