当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > utf8_encode() 函数

PHP
PHP Libxml
PHP Math
PHP Misc
PHP MySQL
PHP SimpleXML
PHP String
PHP XML
PHP Zip
PHP Mail
用PHP5的DirectoryIterators递归扫描目录
PHP 阻止SQL注入式攻击
PHP5面向对象 - 基础 - 类和对象
PHP5面向对象 - 基础 - 类的属性( public )
PHP5面向对象 - 基础 - 类的属性( private )
PHP5面向对象 - 基础 - 方法
PHP5面向对象 - 基础 - 对象的比较
php5面向对象 - 基础 - 构造函数
php5面向对象 - 基础 - 析构函数
用PHP控制用户的浏览器 - ob*函数的使用
PHP PDO 学习笔记

PHP 中的 utf8_encode() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 646 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The utf8_encode() function encodes an ISO-8859-1 string to UTF-8.
utf8_encode()函数的作用是:把ISO-8859-1字符串翻译成UTF-8编码。

Unicode is a universal standard, and has been developed to describe all possible characters of all languages plus a lot of symbols with one unique number for each character/symbol.
统一的字符编码标准[Unicode]是一个通用的标准。对于英文来说,ascii码 0-127就足以代码所有字符,对于中文而言,则必须使用两个字节(byte)来代表一个字符,具第一个字节必须大于127(所以我们有许程序判断中文都是以ascii码大于127作为条件) ,以上用两个字节来表示一个中文的方式,在习惯上称为双字节(即DBCS: Double-Byte Character Set),而相对之下,英文的字符码就称为单字节SBCS(Single-Byte Character Set)。虽然双字节(DBCS)足以解决中英文字符混合使用情况,但对于不同字符系统而言,必须经过字符码转换,非常麻烦。例如:中英文混合情况,日文,韩文等等。为解决这个问题,Apple, Xerox, Microsoft, IBM, Novell, Borland...很多公司联合起来制订了一套可以适用于全世界所有国家的字符码,就称为Unicode。

However, it is not always possible to transfer a Unicode character to another computer reliably. UTF-8 has been developed to transfer a Unicode character from one computer to another
然而,将一个Unicode字符串传输到另一台电脑中通常是不安全的/不可信赖的。UTF-8对Unicode字符的传输进行了改进。

This function returns the encoded string on success, or FALSE on failure.
如果函数执行成功,将返回被编码的字符串,如果失败,将返回False。

Syntax
语法

utf8_encode(string)

Parameter
参数
Description
描述
string Required. Specifies the string to encode
必要参数。指定需要编码的字符串

评论 (0) All

登陆 | 还没注册?