Extended ASCII
We are using JDBCTemplate (Spring) with MySQL as database and AES Encryption technique.
The data in extended ASCII is saved correctly. But when we retrived the data, in the resultset the data is reterived correctly. However when we display the resultset it places question-mark (?) to the extended ASCII.
Why is it does not display the right extended ASCII charecters?
Thanking you in advance
It sounds like a character encoding problem. There are three places where that could go wrong,
1) You use the wrong encoding to write the data,
2) You use the wrong encoding to read the data,
3) You use the wrong encoding to display the data.
If you're displaying it to the console or swing, it's probably not the third one. Check your code at those three places and make sure that you're specifying the encoding to be used for each step.
Doesnt AES encyption require a Base 64 conversion first? If thats it maybe the OP didnt do that?
Well ! the plain text goes in and retrieved fine.
However the encrypted data is okay in resultSet when fetched from mySql (where the encryption is implemented). But when put into java displayed ? with some char s (extended ASCII).
I will highly appreciate if you provide me with AES (Encryption/Decryption) sample/solution in Java.
My Encryption is done at database level (MySQL). I only pass the query string and the key to decrypt.
I still think hunter is correct... at some stage you're probably saying this character stream is ISO8859-1 when it is in fact UTF-8... or more probably just not specifying the character encoding at all, in which case your at the whimsy of your webserver, your DBMS, and your custom encyption layer.
Check your character encodings.
Well I don't understand. The character that I am using are 妫?You see you can easily see and type them. Then how come they are "UTF-8"Please advice
> Well I don't understand. The character that I am
> using are 妫?
> You see you can easily see and type them. Then how
> come they are "UTF-8"
>
> Please advice
Based on your responses in this thread and in http://forum.java.sun.com/thread.jspa?threadID=5176938&messageID=9689678#9689678 I don't think you have a good enough knowledge of Java or cryptography to take this forward. I suggest you spend some time reading about Java and the JCE and experimenting with it before writing another line of production code.
> Well I don't understand. The character that I am
> using are 妫?
> You see you can easily see and type them. Then how
> come they are "UTF-8"
>
> Please advice
[url=http://www.joelonsoftware.com/articles/Unicode.html]The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)[/url]
Yeah, read that. And which of the 237 different "extended ASCII" character sets do you think you are using?
Extended ASCII characters are 骣?
> Extended ASCII characters are
>
> 骣?
Those are characters alright, but they don't answer the question. What character encoding are you trying to use? If you don't know the difference between a character and it's encoding, then you haven't done your required reading.