PHP: Sorunlar bir UTF-8 dizesi en sık karakter bulma ("? Cs ¬ 土ç" örneğin å å ® ¶ CS ¬ å ° ¨ cs ¬ å æ ¡± ± '¨)?

0 Cevap php

Bir MySQL veritabanı ben şu utf-8 karakter çıkarabilir:

"唐犬土用家犬尨犬山桑山犬巴戦師子幻日幻月引綱忠犬愛犬戌年成犬教条教義"

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.

(Ve ben VAR SET NAMES ..., vb)

A) Where is the problem? B) Could I do the job without resorting to arrays altogether (i.e. just using string function)?

Yardımlarınız için teşekkürler.

0 Cevap