فهرست منبع

[DOCUMENTATION] English : add usage in CJK languages.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19422 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp 16 سال پیش
والد
کامیت
448ff56bd1
1فایلهای تغییر یافته به همراه28 افزوده شده و 0 حذف شده
  1. 28 0
      documentation/manual/en/module_specs/Zend_Mail-CharacterSets.xml

+ 28 - 0
documentation/manual/en/module_specs/Zend_Mail-CharacterSets.xml

@@ -15,6 +15,34 @@
             Character sets are only applicable for message parts in text format.
         </para>
     </note>
+
+    <example id="zend.mail.character-sets.cjk">
+        <title>Usage in CJK languages</title>
+
+        <para>
+            The following example is how to use <classname>Zend_Mail</classname> in Japanese. This is one of
+            <acronym>CJK</acronym> (aka <acronym>CJKV</acronym> ) languages. If you use Chinese, you may use
+            <acronym>HZ-GB-2312</acronym> instead of <acronym>ISO-2022-JP</acronym>.
+        </para>
+
+        <programlisting language="php"><![CDATA[
+//We suppose that character encoding of strings is UTF-8 on PHP script.
+function myConvert($string) {
+    return mb_convert_encoding($string, 'ISO-2022-JP', 'UTF-8');
+}
+
+$mail = new Zend_Mail('ISO-2022-JP');
+//In this case, You can use ENCODING_7BIT because the ISO-2022-JP does not use MSB.
+$mail->setBodyText(myConvert('This is the text of the mail.'), null, Zend_Mime::ENCODING_7BIT);
+$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
+$mail->setFrom('somebody@example.com', myConvert('Some Sender'));
+$mail->addTo('somebody_else@example.com', myConvert('Some Recipient'));
+$mail->setSubject(myConvert('TestSubject'));
+$mail->send();
+]]></programlisting>
+
+    </example>
+
 </sect1>
 <!--
 vim:se ts=4 sw=4 et: