svn: /phpdoc/zh/trunk/reference/mbstring/ functions/mb-check-encoding.xml functions/mb-decode-numericentity.xml functions/mb-detect-order.xml
functions/mb-encode-mimeheader.xml http-inout.xml
| From: | Dai Jie | Date: | Thu, 19 Jan 2017 14:18:33 +0000 |
| Subject: | svn: /phpdoc/zh/trunk/reference/mbstring/ functions/mb-check-encoding.xml functions/mb-decode-numericentity.xml functions/mb-detect-order.xml functions/mb-encode-mimeheader.xml http-inout.xml |
||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-4756@lists.php.net to get a copy of this message | ||
daijie Thu, 19 Jan 2017 14:18:33 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=341691
Log:
Sync with En
Changed paths:
U phpdoc/zh/trunk/reference/mbstring/functions/mb-check-encoding.xml
U phpdoc/zh/trunk/reference/mbstring/functions/mb-decode-numericentity.xml
U phpdoc/zh/trunk/reference/mbstring/functions/mb-detect-order.xml
U phpdoc/zh/trunk/reference/mbstring/functions/mb-encode-mimeheader.xml
U phpdoc/zh/trunk/reference/mbstring/http-inout.xml
Modified: phpdoc/zh/trunk/reference/mbstring/functions/mb-check-encoding.xml
===================================================================
--- phpdoc/zh/trunk/reference/mbstring/functions/mb-check-encoding.xml 2017-01-19 14:06:07 UTC (rev
341690)
+++ phpdoc/zh/trunk/reference/mbstring/functions/mb-check-encoding.xml 2017-01-19 14:18:33 UTC (rev
341691)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 298918 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 338331 Maintainer: daijie Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mb-check-encoding" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
Modified: phpdoc/zh/trunk/reference/mbstring/functions/mb-decode-numericentity.xml
===================================================================
--- phpdoc/zh/trunk/reference/mbstring/functions/mb-decode-numericentity.xml 2017-01-19 14:06:07 UTC
(rev 341690)
+++ phpdoc/zh/trunk/reference/mbstring/functions/mb-decode-numericentity.xml 2017-01-19 14:18:33 UTC
(rev 341691)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 329377 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 338291 Maintainer: daijie Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mb-decode-numericentity" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -89,6 +89,75 @@
<member><function>mb_encode_numericentity</function></member>
</simplelist>
</para>
+
+ <para>
+ <example>
+ <title><parameter>convmap</parameter> 的例子: 编码(escape) JavaScript
字符串</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function escape_javascript_string($str) {
+ $map = [
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,0,0, // 49
+ 0,0,0,0,0,0,0,0,1,1,
+ 1,1,1,1,1,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,1,1,1,1,1,1,0,0,0, // 99
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1, // 149
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1, // 199
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1, // 249
+ 1,1,1,1,1,1,1, // 255
+ ];
+ // Char encoding is UTF-8
+ $mblen = mb_strlen($str, 'UTF-8');
+ $utf32 = bin2hex(mb_convert_encoding($str, 'UTF-32', 'UTF-8'));
+ for ($i=0, $encoded=''; $i < $mblen; $i++) {
+ $u = substr($utf32, $i*8, 8);
+ $v = base_convert($u, 16, 10);
+ if ($v < 256 && $map[$v]) {
+ $encoded .= '\\x'.substr($u, 6,2);
+ } else if ($v == 2028) {
+ $encoded .= '\\u2028';
+ } else if ($v == 2029) {
+ $encoded .= '\\u2029';
+ } else {
+ $encoded .= mb_convert_encoding(hex2bin($u), 'UTF-8', 'UTF-32');
+ }
+ }
+ return $encoded;
+}
+
+// Test data
+$convmap = [ 0x0, 0xffff, 0, 0xffff ];
+$msg = '';
+for ($i=0; $i < 1000; $i++) {
+ // chr() cannot generate correct UTF-8 data larger value than 128, use mb_decode_numericentity().
+ $msg .= mb_decode_numericentity('&#'.$i.';', $convmap,
'UTF-8');
+}
+
+// var_dump($msg);
+var_dump(escape_javascript_string($msg));
+]]>
+ </programlisting>
+ </example>
+ </para>
</refsect1>
</refentry>
Modified: phpdoc/zh/trunk/reference/mbstring/functions/mb-detect-order.xml
===================================================================
--- phpdoc/zh/trunk/reference/mbstring/functions/mb-detect-order.xml 2017-01-19 14:06:07 UTC (rev
341690)
+++ phpdoc/zh/trunk/reference/mbstring/functions/mb-detect-order.xml 2017-01-19 14:18:33 UTC (rev
341691)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 333192 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 338834 Maintainer: daijie Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mb-detect-order" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -66,8 +66,11 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- &return.success;
+ 设置编码检测顺序时候,成功时返回 &true;,识别时候返回 &false;。
</para>
+ <para>
+ 在获取编码检测顺序的时候,会返回排序过的编码数组。
+ </para>
</refsect1>
<refsect1 role="examples">
Modified: phpdoc/zh/trunk/reference/mbstring/functions/mb-encode-mimeheader.xml
===================================================================
--- phpdoc/zh/trunk/reference/mbstring/functions/mb-encode-mimeheader.xml 2017-01-19 14:06:07 UTC
(rev 341690)
+++ phpdoc/zh/trunk/reference/mbstring/functions/mb-encode-mimeheader.xml 2017-01-19 14:18:33 UTC
(rev 341691)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 334621 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 338519 Maintainer: daijie Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mb-encode-mimeheader" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -14,7 +14,7 @@
<methodsynopsis>
<type>string</type><methodname>mb_encode_mimeheader</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
- <methodparam
choice="opt"><type>string</type><parameter>charset</parameter><initializer>mb_internal_encoding()</initializer></methodparam>
+ <methodparam
choice="opt"><type>string</type><parameter>charset</parameter><initializer>determined
by mb_language()</initializer></methodparam>
<methodparam
choice="opt"><type>string</type><parameter>transfer_encoding</parameter><initializer>"B"</initializer></methodparam>
<methodparam
choice="opt"><type>string</type><parameter>linefeed</parameter><initializer>"\r\n"</initializer></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>indent</parameter><initializer>0</initializer></methodparam>
@@ -33,6 +33,7 @@
<listitem>
<para>
要编码的 <type>string</type>。
+ 它的编码应该和 <function>mb_internal_encoding</function> 一样。
</para>
</listitem>
</varlistentry>
@@ -42,7 +43,6 @@
<para>
<parameter>charset</parameter> 指定了 <parameter>str</parameter>
的字符集名。
其默认值由当前的 NLS
设置(<literal>mbstring.language</literal>)来确定。
- <function>mb_internal_encoding</function> 应当设置为同样的编码。
</para>
</listitem>
</varlistentry>
Modified: phpdoc/zh/trunk/reference/mbstring/http-inout.xml
===================================================================
--- phpdoc/zh/trunk/reference/mbstring/http-inout.xml 2017-01-19 14:06:07 UTC (rev 341690)
+++ phpdoc/zh/trunk/reference/mbstring/http-inout.xml 2017-01-19 14:18:33 UTC (rev 341691)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 301112 Maintainer: daijie Status: ready -->
+<!-- EN-Revision: 341282 Maintainer: daijie Status: ready -->
<!-- Reviewed: no -->
<chapter xml:id="mbstring.http" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">