ch_unix to ch_utf16 : problem with convert_string functions ?

Chetan S cshring at
Thu Nov 16 11:52:01 GMT 2006


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 ?

Chetan Shringarpure

More information about the samba-technical mailing list