1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-24 15:12:20 +01:00
Files
2025-03-27 08:21:25 +08:00

61 lines
2.7 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: c1f37a6c270aadbbb3da56a3973ffd62197adf2b Maintainer: daijie Status: ready -->
<!-- CREDITS: Luffy -->
<book xml:id="book.mbstring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" annotations="interactive">
<?phpdoc extension-membership="bundled" ?>
<title>多字节字符串</title>
<!-- {{{ preface -->
<preface xml:id="intro.mbstring">
&reftitle.intro;
<para>
虽然许多语言每个必要字符都能一对一映射到 8 比特bit的值但也有好几种语言需要非常多的字符来书面通讯以至于它们的编码范围不能仅仅包含在一个字节里一个字节 Byte 由 8 比特 bit 构成。每一比特仅能包含两种不同的值: 1 或 0。所以一字节仅能够表示 256 种不同的值,即 2 的八次方)。
开发多字节字符编码方案是为了在基于字节的常规编码系统中表达超过 256 个字符。
</para>
<para>
在你操作trim、split、splice 等等)多字节编码的字符串的时候,由于在这种编码方案下,两个或多个连续字节可能只表达了一个字符,所以你需要使用专门的函数。
否则,当你将不能检测多字节字符串的函数应用到这个字符串的时候,它可能无法检测多字节字符的起始位置,并以乱码字符串结尾,基本丢失了它原来的意思。
</para>
<para>
<literal>mbstring</literal> 提供了针对多字节字符串的函数,能够帮你处理 PHP 中的多字节编码。
除此以外,<literal>mbstring</literal> 还能在可能的字符编码之间相互进行编码转换。
为了方便起见,<literal>mbstring</literal> 设计成了处理基于 Unicode 的编码,类似 UTF-8、UCS-2 及诸多单字节的编码(在 <link linkend="mbstring.supported-encodings">支持的编码</link> 列出了)。
</para>
</preface>
<!-- }}} -->
&reference.mbstring.setup;
&reference.mbstring.constants;
&reference.mbstring.encodings;
&reference.mbstring.ja-basic;
&reference.mbstring.http-inout;
&reference.mbstring.supported-encodings;
&reference.mbstring.overloading;
&reference.mbstring.encoding-requirements;
&reference.mbstring.reference;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->