I'm trying to upgrade legacy system to PHP 5.5.38 from PHP 5.3.3. I read data from db and write to file and process the file. When using PHP 5.3.3 (PHP ini default charset latin or utf8), the encoding chars(non-english chars) works fine but when using PHP 5.5.38, the encoding chars does not work well.
I changed RDS db configuration params character-set-server = latin1 in staging server, the encoding works fine.
Production RDS MYSQL DB configuration
mysql> show variables like "%character%";
+--------------------------+-----------------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /rdsdbbin/oscar-5.6.mysql_aurora.1.19.2.0.157.0/share/charsets/ |
+--------------------------+-----------------------------------------------------------------+
but contents in table is using latin chars. When I view the text in mysql client I see this
บริà¸à¸²à¸£ Model clip หน้าใหม่เด็ดๆ คิดเงิน 5บ. ดู
PHP 5.3.3 using PEAR version: 1.9.4
PHP 5.5.38 using PEAR version: 1.10.12
I don't understand what causes this issue? How it works in PHP 5.3.3 but not in PHP 5.5.38 (not using htmlspecialchars) after reading the data from DB, just write it to file.
I checked PEAR change log but I couldn't find anything related to charset.
Thanks in advance.