init_unistr2 length calculation

Shirish Kalele kalele at veritas.com
Thu Feb 13 18:26:32 GMT 2003


On Thu, 13 Feb 2003, Gerald (Jerry) Carter wrote:
>On Wed, 12 Feb 2003, Shirish Kalele wrote:
>> In init_unistr2, the string length for the UNISTR2 structure seems to be set
>> equal to the number of bytes occupied by the string when encoded in the Unix
>> charset (i.e. the value returned by strlen()). This is not necessarily the
>> number of characters in the string (given UTF-8 and other variable-byte
>> charsets).
>>
>> Shouldn't this actually be set to half the number of bytes occupied by the
>> string after encoding it in UCS2? Here's a patch that does this.
>
>I think you might get into trouble here due to difference in the MS
>unicode marshalling "flexibility".

I don't understand. Could you elaborate?

Thanks,
Shirish



More information about the samba-technical mailing list