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

[417 byte] By [muhammadowaisa] at [2007-11-27 5:32:40]
# 1

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.

hunter9000a at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 2
Doesnt AES encyption require a Base 64 conversion first? If thats it maybe the OP didnt do that?
TuringPesta at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 3

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.

muhammadowaisa at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 4
My Encryption is done at database level (MySQL). I only pass the query string and the key to decrypt.
muhammadowaisa at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 5

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.

corlettka at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 6
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
muhammadowaisa at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 7

> 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.

sabre150a at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 8

> 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]

hunter9000a at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 9
Yeah, read that. And which of the 237 different "extended ASCII" character sets do you think you are using?
DrClapa at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 10
Extended ASCII characters are 骣?
muhammadowaisa at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 11

> 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.

hunter9000a at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...
# 12
ISO-8859-1
muhammadowaisa at 2007-7-12 14:59:05 > top of Java-index,Java Essentials,Java Programming...