I'm struggling with the encoding of the content of an external interface. In the MySQL database the collation is latin1_swedish_ci
. Also the collation of the field ist latin1_swedish_ci
. The php script is encoded in UTF-8 and the output in the browser gives me UTF-8. Everything is working fine except the content of this database. The database connection should be UTF-8 (Typo3 4.7) and the content is
straße
but it should be straße
.
mb_detect_encoding($data['street'],'UTF-8')
says it is UTF-8
. If I use utf8_decode()
I get
stra�?e
If I use utf8_encode()
I get
straße
My assumption was that UTF-8 encoded data is stored in ISO-8859-1
, but if this would be the case this shouldn't make such problems here. How do I find out what the real encoding is?
PS: I cannot change the encoding of the source!
My solution for my initial problem:
I had to set the datbase connection from UTF-8 to ISO-8859-1 with this line of code
$res = $GLOBALS['TYPO3_DB']->sql_query("SET NAMES latin1");