@@ -195,7 +195,7 @@ msgstr "与现有的 C 函数(如 ``strlen()`` )不兼容,因此需要采
195195msgid ""
196196"Therefore this encoding isn't used very much, and people instead choose "
197197"other encodings that are more efficient and convenient, such as UTF-8."
198- msgstr ""
198+ msgstr "因此这种编码用得不多,人们转而选择其他更高效、更方便的编码,比如 UTF-8。 "
199199
200200#: ../../howto/unicode.rst:126
201201msgid ""
@@ -205,26 +205,28 @@ msgid ""
205205"and UTF-32 encodings, but they are less frequently used than UTF-8.) UTF-8 "
206206"uses the following rules:"
207207msgstr ""
208+ "UTF-8 是最常用的编码之一,Python 往往默认会采用它。UTF 代表“Unicode Transformation Format”,'8' "
209+ "表示编码采用 8 位数。(UTF-16 和 UTF-32 编码也是存在的,但其使用频率不如 UTF-8。)UTF-8 的规则如下: "
208210
209211#: ../../howto/unicode.rst:132
210212msgid ""
211213"If the code point is < 128, it's represented by the corresponding byte "
212214"value."
213- msgstr ""
215+ msgstr "如果码位 < 128,则直接用对应的字节值表示。 "
214216
215217#: ../../howto/unicode.rst:133
216218msgid ""
217219"If the code point is >= 128, it's turned into a sequence of two, three, or "
218220"four bytes, where each byte of the sequence is between 128 and 255."
219- msgstr ""
221+ msgstr "如果码位 >= 128,则转换为 2、3、4 个字节的序列,每个字节值都位于 128 和 255 之间。 "
220222
221223#: ../../howto/unicode.rst:136
222224msgid "UTF-8 has several convenient properties:"
223- msgstr ""
225+ msgstr "UTF-8 有几个很方便的特性: "
224226
225227#: ../../howto/unicode.rst:138
226228msgid "It can handle any Unicode code point."
227- msgstr ""
229+ msgstr "可以处理任何 Unicode 码位。 "
228230
229231#: ../../howto/unicode.rst:139
230232msgid ""
@@ -234,23 +236,26 @@ msgid ""
234236" sent through protocols that can't handle zero bytes for anything other than"
235237" end-of-string markers."
236238msgstr ""
239+ "Unicode 字符串被转换为一个字节序列,仅在表示空(null )字符(U+0000)时才会包含零值的字节。这意味着 ``strcpy()`` "
240+ "之类的C 函数可以处理 UTF-8 字符串,而且用那些不能处理字符串结束符之外的零值字节的协议也能发送。 "
237241
238242#: ../../howto/unicode.rst:144
239243msgid "A string of ASCII text is also valid UTF-8 text."
240- msgstr ""
244+ msgstr "ASCII 字符串也是也是也是合法的 UTF-8 文本。 "
241245
242246#: ../../howto/unicode.rst:145
243247msgid ""
244248"UTF-8 is fairly compact; the majority of commonly used characters can be "
245249"represented with one or two bytes."
246- msgstr ""
250+ msgstr "UTF-8 相当紧凑;大多数常用字符均可用一两个字节表示。 "
247251
248252#: ../../howto/unicode.rst:147
249253msgid ""
250254"If bytes are corrupted or lost, it's possible to determine the start of the "
251255"next UTF-8-encoded code point and resynchronize. It's also unlikely that "
252256"random 8-bit data will look like valid UTF-8."
253257msgstr ""
258+ "如果字节数据被损坏或丢失,则可以找出下一个 UTF-8 码点的开始位置并重新开始同步。随机的 8 位数据也不太可能像是有效的 UTF-8 编码。"
254259
255260#: ../../howto/unicode.rst:150
256261msgid ""
@@ -260,6 +265,8 @@ msgid ""
260265"oriented encodings, like UTF-16 and UTF-32, where the sequence of bytes "
261266"varies depending on the hardware on which the string was encoded."
262267msgstr ""
268+ "UTF-8 是一种面向字节的编码。编码规定了每个字符由一个或多个字节的序列表示。这避免了整数和双字节编码(如 UTF-16 和 "
269+ "UTF-32)可能出现的字节顺序问题,那时的字节序列会因执行编码的硬件而异。"
263270
264271#: ../../howto/unicode.rst:158 ../../howto/unicode.rst:514
265272#: ../../howto/unicode.rst:735
0 commit comments