Topic: Bug and solution-Chinese character are not stored and displayed proper

Bug and solution report

problem:
===========
Chinese character are not stored and displayed properly,
in phpmyadmin, the chinese customer name in table '0_crm_persons' are shown as something like '??ä¸æ?'

Env
=============
debian 6
front account version latest 2.3.19
display language:English(no chinese lang pack for this version)
mysql 5.5.x db colation utf8
mysql 5.5.x db character set utf8
php 5.4.X
apache 2.2.x

Solution
=================
in file includes/db/connect_db.inc
add one line
mysql_query("SET NAMES 'utf8'");

so the code become below
====
$db = mysql_connect($connection["host"], $connection["dbuser"], $connection["dbpassword"]);
   
mysql_query("SET NAMES 'utf8'");
        mysql_select_db($connection["dbname"], $db);
====

Solution result: now even in english display and english lang pack, Chinese character are stored and displayed well.(even though the file is coded as asni, not uft-8)

Some inquiry/suggestion to developers
============
I remember default mysql store format(colation) for frountaccounting is 'latin1', for the sites not using utf8 as mysql store format(such as latin1), how to put a trigger in frontacc setup/installation so user can choose to store with latin1 or utf8
so the code above shall become like mysql_query("SET NAMES $mysql_char_set");

Michael Yu
From Singapore
email: harmonylife2000@gmail.com