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!

Problem with my charset - Spanish

Status
Not open for further replies.

johk02

Programmer
Aug 20, 2003
169
AU
Hi,
I have problem with my charset.
The site is in Spanish and The Spanish characters that come from the database (i.e. dropdowns etc) are replaced with question marks but other Spanish characters are OK.

I have tried to use UTF-8 and iso-8859-1 but they are still showing up as question marks. They are entered in to the database OK. The charset for MySQL are set to UTF-8.

Any suggestion would be much appreciated.

Jonas
 
This is a common problem and there're several things you can check. Interesting quesions are: what default locale do you use on your server and in mysql. Are your templates UTF8?

Try to use this conenction string for your datasource:

?useUnicode=true&characterEncoding=utf8

Example if using mysql jdbc driver:

jdbc:mysql://localhost:3306/mydatabase?useUnicode=true&characterEncoding=utf8

 

When I try the application on my localhost it works OK - no problems with the Spanish characters.
The connection is jdbc:mysql://localhost:3307/holanet and the charset for MySQL is UTF-8.

But for some reason it doesn't seem to work live - The charset for MySQL on my host is UTF-8 Unicode (utf8) .
I have tried to change my page encoding but it doesn't help ie the meta tag see below
Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
SGSE,
Should I ask my host to change the connection string as per your suggest?

Thanks
Jonas
 
If it works on my localhost can I presume that the error is with the host??
The database on my localhost is using UTF and so is the dB at the host.

Jonas
 

This is driving me up the wall.
When I login to phpMyAdmin at my host the Spanish characters look OK.
The MySQL connection collation is UTF-8. The charset on on web page is set to UTF-8 but for some reason the Spanish characters are not displayed properly. I have even tries to set MySQL connection collation to Latin_general_cs and charset to iso-8859-1 but with no effect.
Does anyone have any ideas??

Thanks
Jonas
 
I thought the host had added the &useUnicode=true&characterEncoding=latin1 to the query a month ago after the suggestions from SGSE.When I asked him yesterday it seems like he had forgot. It is now added to the jdbc connection and everything is working fine.

Thanks
Jonas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top