开发者

utf8_general_ci conversion

my script is using utf8_general_ci and im trying to transfer to another script that also use开发者_开发百科s utf8_general_ci the problem is my script store everything as is, like "áéíóú" and the new script as "áéà óú", so im having characters problems like "ru��es" how can I convert that?


When you pull the data out of file #1 make sure to run something like

$data = utf8_encode($data);

This will make sure that PHP understands that it is reading, and should maintain, a UTF8 encoding. After that you should be able to re-write to a file, database, etc without problem. Doing this has solved the issue for me when working with language translations where I know the source is UTF8 but PHP wants to make it something else during the transition.

If that doesn't fix it try running that same function on the body before you send it to the browser.


If your scripts are in different files, make sure that your file encoding is similar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜