Re: Unwanted character conversions
I fixed it now. Seems silly, but setting the MySQL character set explicitly to 'utf8' before the function call was what did the trick.
Somewhere deep down within MySQL and/or PHP, there seems to be a bug here. The trouble is that I always call htmlentities() on any strings I get from the database which might contain extended characters and need to be displayed in HTML. Perhaps our version(s) of MySQL and PHP are a little old, but I have had a lot of trouble using that function in the past when the input was UTF8. Since our server gives you HTML pages in ISO-8859-1 by default, I always send out the PHP header to get them in UTF8. But the MySQL API ignores this, returning the strings in Latin1. The htmlentities function seems/seemed to like it better that way, so I didn't bother with setting the MySQL charset explicitly.
Now it seems that if I DON'T set it to UTF8, it is going behind my back and converting "oe" to "ö" ... but Latin1 "ö", which of course does not display properly in a UTF8 web page. The bug is that this is being converted at all when it is really ASCII text all along. But is it a MySQL bug, or a PHP bug? Where do I submit the bug report???
Subject
Written By
Posted
February 11, 2013 11:07AM
February 11, 2013 11:41AM
February 11, 2013 12:40PM
February 11, 2013 12:50PM
February 11, 2013 01:48PM
Re: Unwanted character conversions
February 11, 2013 04:47PM
February 11, 2013 04:58PM
February 11, 2013 11:48PM
February 12, 2013 06:21AM
February 12, 2013 07:48PM
February 12, 2013 08:55PM
February 12, 2013 09:25PM
February 15, 2013 12:32PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.