使用Unicode与PHP

时间:2010-02-09 16:40:31

标签: php unicode character-encoding

如何将 Unicode PHP

一起使用

我想将Unicode值存储在PHP 变量中,但它会输出一些问号

什么是解决方案

3 个答案:

答案 0 :(得分:8)

在php.ini中:

default_charset = "UTF-8"
mbstring.internal_encoding = "UTF-8"

; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
mbstring.func_overload = 4

答案 1 :(得分:4)

确保您的输出编码为utf8

 header('Content-type: text/html; charset=utf-8');

PS接受一些答案。

答案 2 :(得分:3)

这是你必须要正确阅读的内容,但这里有两个你应该开始的链接: Character Sets / Character Encoding Issues Handling UTF-8 with PHP