[jdev] Get the length of the utf-8 sequence in Java
Matthias Wimmer
m at tthias.net
Thu Sep 9 03:11:27 CDT 2004
Hi list!
Is there a better way in Java to get the length in bytes of an UTF-8
sequence of a string, than to just convert it to a byte array and check
the arrays length? I have to validate JIDs which are only allowed to
have 1023 byte UTF-8 strings for each portion. I have not found an
elegant way to do this in Java as length of the string returns the
number of characters in a string and not the number of bytes in its
UTF-8 representation.
Tot kijk
Matthias
--
Fon: +49-(0)70 0770 07770 http://web.amessage.info
HAM: DB1MW xmpp:mawis at amessage.info
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://www.jabber.org/jdev/attachments/20040909/e0bdfa64/attachment-0002.pgp>
More information about the JDev
mailing list