Encoding issues … windows-1255 to utf 8?

后端 未结 4 1042
青春惊慌失措
青春惊慌失措 2021-01-17 06:43

Encoding convert from windows-1255 to utf-8 was asked before I know, but I\'m still getting different results and I can\'t solve it.

The first issue is \"does php ic

4条回答
  •  醉梦人生
    2021-01-17 07:13

    I found that the problem is not in the convertion function like iconv, it's in the database connection. the script open connection with latin1 charset by default then when it writes in the table with utf8 strings data enter bad. You must be sure your connection is UTF8 like your data.

    With mysql you can see it with

    print mysqli_character_set_name($link)."\n";
    

    and if it's not UTF8 then set the connection charset

    mysqli_set_charset($link, "utf8");
    

    Then everything will be ok with iconv('ISO-8859-8','UTF-8//IGNORE',hebrev($value)); for visual hebrew to UTF8 or any convertion function

提交回复
热议问题