From an MySQL database I can extract the following utf-8 characters:
"唐犬土用家犬尨犬山桑山犬巴戦師子幻日幻月引綱忠犬愛犬戌年成犬教条教義"
I am trying to find the most frequent character in this string. I tried putting each as element into an array $arr and do array_count_values($arr); Unfortunately the array operations (or is print_r the culprit?) produce mis-encoded output like this:
[0] => � [1] => � [2] => � [3] => �
I can display the characters fine in other situations (i.e. retrieving from MySQL and displaying the characters within php works OKAY!), but the array functions (or array output) seem to mess things up.
I HAVE changed /etc/php5/apache2/php.ini
and put default_charset = "utf-8"
in there.
(And I HAVE SET NAMES ...
etc)
A) Where is the problem? B) Could I do the job without resorting to arrays altogether (i.e. just using string function)?
Thanks for your help.