Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > Re: Encoding co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 27 Topic 3647 of 3876
Post > Topic >>

Re: Encoding conversion problem

by Silvio Bierman <sbierman@[EMAIL PROTECTED] > Feb 13, 2008 at 12:48 PM

Andrea wrote:
> Hi Roedy,
> the database (DB2) has this configuration:
> ...
> Database territory     = US
> Database code page     = 850
> Database code set      = IBM-850
> ...
> 
> I've ex****ted to a file the content of a table with a CHAR(N) field
> containing the EURO currency character, then I've opened the file with
> EncodingRecognizer: if I choose IBM850 I see a strange character (like
> a small X), if I choose ISO-8859-1 I see a square.
> 
> I tried a translation with:
> 
> String problematicString = rs.getString(index);
> problematicString = new String(problematicString, "IBM850"); // Am I
> correct?
> 
> but I still get garbage :-(
> 
> 
> Thanks,
> Andrea

You should look at the numeric byte values in problematicString. That 
could give you an idea of what you are dealing with although it will 
only disclose what your JDBC driver has made of it. It might have 
already done an incorrect interpretation of a byte sequence.
Things could be even worse, the data could already have been mutilated 
during insertion in the database when some program (possibly the same 
program + JDBC driver?) put the data in. If the database encoding does 
not sup****t all characters that where in the original data then that is 
what most likely happened.

Really, as I said in my previous post you should consider (a) going to a 
different database that sup****ts Unicode (b) refrain from 
using/sup****ting non ASCII characters in your application or (c) do what 
others have suggested and do your own translation from Unicode -> ASCII 
-> DB -> ASCII -> Unicode. The latter option is only realistic if you 
have wrapped all your JDBC code in some generic wrappers (which is 
usually a good idea) so you can handle this locally.

Good luck,

Silvio
 




 27 Posts in Topic:
Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-11 04:03:47 
Re: Encoding conversion problem
Lothar Kimmeringer <ne  2008-02-12 08:13:28 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-12 00:25:51 
Re: Encoding conversion problem
Lothar Kimmeringer <ne  2008-02-14 20:11:04 
Re: Encoding conversion problem
Sabine Dinis Blochberger   2008-02-12 09:33:03 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-12 03:22:17 
Re: Encoding conversion problem
Sabine Dinis Blochberger   2008-02-12 13:02:17 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-12 06:33:21 
Re: Encoding conversion problem
Roedy Green <see_websi  2008-02-12 18:07:31 
Re: Encoding conversion problem
Roedy Green <see_websi  2008-02-12 18:10:54 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-13 03:22:16 
Re: Encoding conversion problem
Silvio Bierman <sbierm  2008-02-13 12:36:49 
Re: Encoding conversion problem
Silvio Bierman <sbierm  2008-02-13 12:48:33 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-13 06:22:22 
Re: Encoding conversion problem
Silvio Bierman <sbierm  2008-02-13 16:39:59 
Re: Encoding conversion problem
Roedy Green <see_websi  2008-02-13 16:38:17 
Re: Encoding conversion problem
Roedy Green <see_websi  2008-02-13 16:36:07 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-13 07:28:19 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-14 08:00:45 
Re: Encoding conversion problem
Silvio Bierman <sbierm  2008-02-14 21:44:14 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-15 03:26:40 
Re: Encoding conversion problem
Lew <lew@[EMAIL PROTEC  2008-02-15 08:10:47 
Re: Encoding conversion problem
Sabine Dinis Blochberger   2008-02-15 12:02:46 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-15 06:51:52 
Re: Encoding conversion problem
Lew <lew@[EMAIL PROTEC  2008-02-15 10:00:01 
Re: Encoding conversion problem
Andrea <tol7481@[EMAIL  2008-02-15 09:02:46 
Re: Encoding conversion problem
Silvio Bierman <sbierm  2008-02-15 18:16:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 23:37:05 CST 2008.