9 messages in com.mysql.lists.javaRE: Encoding independent text data in...| From | Sent On | Attachments |
|---|---|---|
| Richard Bolen | 01 May 2003 11:11 | |
| Lastric Igor | 05 May 2003 01:16 | |
| GV | 05 Jul 2003 16:17 | |
| Frank Gates | 05 Jul 2003 16:32 | |
| Frank Gates | 05 Jul 2003 16:38 | |
| GV | 06 Jul 2003 03:09 | |
| mike markovich | 07 Jul 2003 07:55 | |
| Frank Gates | 07 Jul 2003 08:03 | |
| Guus Holshuijsen | 07 Jul 2003 23:13 |
| Subject: | RE: Encoding independent text data in mysql?![]() |
|---|---|
| From: | Lastric Igor (last...@galexis.com) |
| Date: | 05/05/2003 01:16:58 AM |
| List: | com.mysql.lists.java |
Hi ,
Why should you want to store different encodings into mySql DB?
You can easily do conversion after you retrieve it from the DB.
Try this: public static String encode(String value) { String toReturn = null; if (value != null && value.length() > 0) { try { toReturn = new String(value.getBytes("ISO-8859-1"), PropertiesManager.getEncoding()); } catch (UnsupportedEncodingException e) { } } return toReturn; }
public static String decode(String value) { String toReturn = null; if (value != null && value.length() > 0) { try { toReturn = new String(value.getBytes(PropertiesManager.getEncoding()), "ISO-8859-1"); } catch (UnsupportedEncodingException e) { } } return toReturn; }
- PropertiesManager.getEncoding() - gives the encoding configured for the application - instead of hardcoding "ISO-8859-1", one could ask for SystemSetting file.encoding used by JVM
mit freundlichen Grüssen / best regards / srdacan pozdrav / meilleures salutations / med glada hälsningar Galexis AG Igor LASTRIC · Fachtechnische Koordination SW-Entwicklung (DDIS/ASW) Grubenstrasse 11 · CH-3322 Schoenbuehl tel: +41 (0)31 858 73 36 · fax: +41 (0)31 858 78 78 · mobile: +41 (0)79 447 07 70 last...@galexis.com <mailto:last...@galexis.com> < mailto:last...@galexis.com <mailto:last...@galexis.com> > . < http://www.e-galexis.com/ <http://www.e-galexis.com/> >
-----Original Message----- From: Richard Bolen [mailto:bol...@GretagMacbeth.com] Sent: Thursday, May 01, 2003 8:12 PM To: ja...@lists.mysql.com Subject: Encoding independent text data in mysql?
Is there a way to store text data in various encodings in one mysql database instance? When I attempted to store Big5 encoded text in the database it converted it to UTF-8 (with useUnicode=true on the connect URL but no encoding specified). It worked when I added the characterEncoding=Big5 to my connection URL. The thing is, I need to store text data of different ecoding types and I can't change my connection URL in each case. Is this possible?
Thanks, Rich
This message may contain confidential information and is intended only for the individual named herein. If you are not the herein named addressee you should not disseminate, distribute, copy or otherwise make use of this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake, and delete this e-mail from your system. Thank you.




