Thursday, May 6, 2010

Re: character encoding issues

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/05/10 18:32, Sripathi Krishnan wrote:
> Just a correction - GWT uses UTF-8 and not UTF-16. Also, you *can* do
> String.getBytes() and similar hacks to convert from ISO-8859-1 (oracle) to
> UTF-8 -- but in my opinion it is best to store data in UTF-8 in the
> database.

GWT *source code* is UTF-8 (if you know what's good for you!). GWT
*strings* are UTF-16 --- because the Java spec says so. String.charAt()
will return you an unboxed Character, which is a single UTF-16 value.
It's vitally important to note that this is not the same as a Unicode
code point! Some code points get stored as pairs of Characters, so if
you assume your string contains Unicode your app will break on some
strings. You need String.codePointAt() to get a Unicode code point, but
I haven't checked to see whether that's supported on the client.

String.getBytes() is not supported by GWT, and will only work on the
server (where it's running real Java).

- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────

│ "There is no Fermi Paradox. Any time space faring aliens make it to
│ Earth, the cows get them." --- Sam Starfall
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFL40dDf9E0noFvlzgRAs3fAJ9Gm3EBkuBu6+5DRKptNiz6XEqXSQCfXn2e
DFFOoY3blHvzlWgoQ+GBOaI=
=g1tt
-----END PGP SIGNATURE-----

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate