2 messages in com.mysql.lists.javaRe: Strings with Unicode escape seque...| From | Sent On | Attachments |
|---|---|---|
| Lisa N. Michaud | 13 Jul 2005 09:45 | |
| Mark Matthews | 13 Jul 2005 12:20 |
| Subject: | Re: Strings with Unicode escape sequences not displaying?![]() |
|---|---|
| From: | Mark Matthews (ma...@mysql.com) |
| Date: | 07/13/2005 12:20:15 PM |
| List: | com.mysql.lists.java |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Lisa N. Michaud wrote:
Hello, all -
I am working on a system for tutoring students in Anglo Saxon English (think JRR Tolkein's specialty) and thus need to be able to display a few special characters not in modern English, such as thorn and eth.
I have no trouble creating JLabels with the strings containing the codes such as "\u00f0" within Java itself. The characters display beautifully -
HOWEVER -
I have a nice big list of words for translation exercises that are stored in my MySQL database, all of which have the \u codes in them to represent the characters. When my applet fetches these strings from a result set using getString(), it does not recognize and convert the \u sequences when it displays them in JLabels (or anything else for that matter, including just outputting to the console).
Lisa,
The \u sequence only makes sense to the Java _compiler_ as a string literal. Storing them that way via JDBC isn't going to do anything.
When you say "does not recognize" what do you mean exactly? Do you still see \u00f0 in your text, or is the output corrupted? Do you have MySQL configured to use utf-8 or ucs2 as a character set for storage in the table? (otherwise it's not going to store these kinds of characters).
-Mark
- -- Mark Matthews MySQL AB, Software Development Manager - Connectivity www.mysql.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFC1WmFtvXNTca6JD8RAoI0AJ9x6yV4DCNZvjLmC26PETV5nisZfQCgtNWv fVrX5DDzNyav42IQmI4ICtI= =US7N -----END PGP SIGNATURE-----




