init_unistr2 length calculation
Gerald (Jerry) Carter
jerry at samba.org
Thu Feb 13 18:16:03 GMT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 12 Feb 2003, Shirish Kalele wrote:
> Hi,
>
> 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".
cheers, jerry
----------------------------------------------------------------------
Hewlett-Packard ------------------------- http://www.hp.com
SAMBA Team ---------------------- http://www.samba.org
GnuPG Key ---- http://www.plainjoe.org/gpg_public.asc
"You can never go home again, Oatman, but I guess you can shop there."
--John Cusack - "Grosse Point Blank" (1997)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
Comment: For info see http://quantumlab.net/pine_privacy_guard/
iD8DBQE+S+DjIR7qMdg1EfYRAhBLAKDR29obVicYcRCccXJTjC1qMiFocgCfWzEj
9VrIzCyuKMQ0aanmUvty8P0=
=GqyI
-----END PGP SIGNATURE-----
More information about the samba-technical
mailing list