Henrik O. Skogmo
Henrik O. Skogmo

Reputation: 2013

Changing character encoding in MySQL?

In a web application I'm working on all the content seems fine, except for the content which seems to be retrieved from the database. Some special characters are used, and they break - so it's deffinatly a character encoding error somewhere.

When I manually in the browser try to switch from iso-8859-1 to utf-8 the database-content looks fine, but the static is messed up. And vice versa. So I suspect that the static content is iso-8859-1, and the content from the database is utf-8.

I've looked around for some configuration files which states the charset, but when I try changing it, nothing happen.

Will converting my database content to iso-8859-1 help maybe, so it correlates with the static content? In that case, how? I've tried changing the schema and collation but the effect was seamless.

Edit: My apologies. This is an MySQL database.

Upvotes: 0

Views: 241

Answers (1)

dexter.ba
dexter.ba

Reputation: 292

Maybe it is an issue with your client library that communicates to MySQL.

Before you try to retrieve data from the database, execute this query: SET NAMES 'utf8'

reference: http://forums.mysql.com/read.php?103,46870,47245#msg-47245

Hope this helps.

Upvotes: 1

Related Questions