Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"?" instead of euro symbol

Status
Not open for further replies.

apffal

Technical User
Apr 10, 2004
97
PT
I get "?" instead of Euro symbol, as a result, in a JDBC text field.
Is it possible to solve this ?
Thanks.
 
I mean : a text field for getting results with JDBC
 
Yes, I get results in a TextField from a mysql database
 
Symbol-problems may have different source and solutions:
The database handles encodings.
The OS handles encodings.
Your java-program handles encodings.

Can you enter your symbol manually/ programmatically?
Did you write the symbol to console and to a file?
Can you write the result from the database to console and to a file?

seeking a job as java-programmer in Berlin:
 
I enter all my data in Mysql - and euro symbols display correctly if I make a search, for instance in phpMysqlAdmin.
They change to "?" only if I search with a Java program via JDBC.
And I cannot fix that - if I edit the TextField, save the change and restart the application, I get "?" instead of "€" again !
 
Problem with fonts ?
In java program, I'm using "Helvetica", Font.PLAIN, 12.
What should I use ?
 
When I understood your previous posting correctly, you may insert the Euro-Symbol with your keyboard, so the font doesn't make trouble in this case.

Your general database-settings work too, because you tested with php-mySqlAdmin.

What is the byte-value you get via jdbc?
Did you write it to a file?
To console (System.out.println (buggy);)?

seeking a job as java-programmer in Berlin:
 
Excuse me for delay !
I found this is a encoding problem, since my database uses ISO-8859-1, which has no euro symbol support, and ISO-8859-15 has it.
So, I've changed
String url= "jdbc:mysql://127.0.0.1/test";
to
String url= "jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=ISO-8859_15";
And now I get a NullPointerException
What's wrong ?
 
I receive the NPE in terminal window (either in windows or linux), when I execute java program and try get results from database
 
Any stacktrace?

Maybe you need to configure something at database manager

Cheers,

Dian
 
As I said, in Mysql, euro symbols display correctly if I make a search, for instance with phpMysqlAdmin.
They change to "?" only if I search with a Java program via JDBC.
So, it's a Java encoding problem.
Something wrong with my String ?url= "jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=ISO-8859_15"
 
I solved the problem, changing utf-8 database collation to default - now, I get euro symbol via JDBC
Thanks, anyway !
 
Ahhhh, that makes thing a lot clearer...

I guess that is a database configuration parameter that has nothing to do with Java.

Cheers,

Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top