I've been having a lot of encoding troubles with PHP/Mongo in general.
Right now, I'm in the process of converting some data from MySQL to Mongo. I have a string that contains a é
, but when I try to encode it to UFT-8 (via mb_convert_encoding
, uft8_encode
), it turns into é
. I'm sure other strings also contain other accented characters.
I've tried mb_detect_encoding
, which told me the string is UTF-8, but when I do mb_check_encoding($string, 'UTF-8')
, it returns false.
Basically, I have no idea what's wrong. This is on a page that is just a PHP script, no HTML. Any advice to this problem, or in general maintaining character encoding when inserting into Mongo?
Here is the script in question: https://plnkr.co/edit/eAkLxfklzLNCsZTBPKsX
The MySQL table is using a MyISAM engine, charset utf8, collation utf8_unicode_ci