I meant GWT *RPC* explicitly sets character encoding to UTF-8 to transfer data from server to client and back. It does not matter how javascript internally stores characters; the problem here is that you are lying to javascript. You say "these raw bytes are UTF-8 encoded", but in fact they are encoded in ISO-8859-1.
--Sri On 7 May 2010 04:18, David Given <[email protected]> wrote: > -----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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-web-toolkit%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
