Mercurial > hg > nginx-site
comparison xml/en/docs/njs/reference.xml @ 2688:dd2bbd104146
Unified spelling of UTF-8 in njs.
Rules for spelling UTF-8 in njs Reference:
- utf8 when it is a value
- UTF-8 when it is a part of a text
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Fri, 19 Mar 2021 18:24:34 +0000 |
parents | 7ff9d8bda757 |
children | 7e271437f12e |
comparison
equal
deleted
inserted
replaced
2687:7ff9d8bda757 | 2688:dd2bbd104146 |
---|---|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> | 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
8 | 8 |
9 <article name="Reference" | 9 <article name="Reference" |
10 link="/en/docs/njs/reference.html" | 10 link="/en/docs/njs/reference.html" |
11 lang="en" | 11 lang="en" |
12 rev="70"> | 12 rev="71"> |
13 | 13 |
14 <section id="summary"> | 14 <section id="summary"> |
15 | 15 |
16 <para> | 16 <para> |
17 <link doc="index.xml">njs</link> provides objects, methods and properties | 17 <link doc="index.xml">njs</link> provides objects, methods and properties |
231 <tag-name id="r_request_text"><literal>r.requestText</literal></tag-name> | 231 <tag-name id="r_request_text"><literal>r.requestText</literal></tag-name> |
232 <tag-desc> | 232 <tag-desc> |
233 the same as <link id="r_request_buffer"><literal>r.requestBuffer</literal></link>, | 233 the same as <link id="r_request_buffer"><literal>r.requestBuffer</literal></link>, |
234 but returns a <literal>string</literal>. | 234 but returns a <literal>string</literal>. |
235 Note that | 235 Note that |
236 it may convert bytes invalid in utf8 encoding into the replacement character. | 236 it may convert bytes invalid in UTF-8 encoding into the replacement character. |
237 </tag-desc> | 237 </tag-desc> |
238 | 238 |
239 <tag-name id="r_raw_headers_in"><literal>r.rawHeadersIn{}</literal></tag-name> | 239 <tag-name id="r_raw_headers_in"><literal>r.rawHeadersIn{}</literal></tag-name> |
240 <tag-desc> | 240 <tag-desc> |
241 returns an array of key-value pairs | 241 returns an array of key-value pairs |
303 <tag-desc> | 303 <tag-desc> |
304 the same as <link id="r_response_buffer"><literal>r.responseBuffer</literal></link> | 304 the same as <link id="r_response_buffer"><literal>r.responseBuffer</literal></link> |
305 but returns a string | 305 but returns a string |
306 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | 306 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). |
307 Note that | 307 Note that |
308 it may convert bytes invalid in utf8 encoding into the replacement character. | 308 it may convert bytes invalid in UTF-8 encoding into the replacement character. |
309 </tag-desc> | 309 </tag-desc> |
310 | 310 |
311 <tag-name id="r_return"><literal>r.return(status[, | 311 <tag-name id="r_return"><literal>r.return(status[, |
312 string | Buffer])</literal></tag-name> | 312 string | Buffer])</literal></tag-name> |
313 <tag-desc> | 313 <tag-desc> |
971 <para> | 971 <para> |
972 Byte strings contain a sequence of bytes | 972 Byte strings contain a sequence of bytes |
973 and are used to serialize Unicode strings | 973 and are used to serialize Unicode strings |
974 to external data and deserialize from external sources. | 974 to external data and deserialize from external sources. |
975 For example, the <link id="string_toutf8">toUTF8()</link> method serializes | 975 For example, the <link id="string_toutf8">toUTF8()</link> method serializes |
976 a Unicode string to a byte string using UTF8 encoding: | 976 a Unicode string to a byte string using UTF-8 encoding: |
977 <example> | 977 <example> |
978 >> '£'.toUTF8().toString('hex') | 978 >> '£'.toUTF8().toString('hex') |
979 'c2a3' /* C2 A3 is the UTF8 representation of 00A3 ('£') code point */ | 979 'c2a3' /* C2 A3 is the UTF-8 representation of 00A3 ('£') code point */ |
980 </example> | 980 </example> |
981 The <link id="string_tobytes">toBytes()</link> method serializes | 981 The <link id="string_tobytes">toBytes()</link> method serializes |
982 a Unicode string with code points up to 255 into a byte string, | 982 a Unicode string with code points up to 255 into a byte string, |
983 otherwise, <literal>null</literal> is returned: | 983 otherwise, <literal>null</literal> is returned: |
984 <example> | 984 <example> |
1018 </tag-desc> | 1018 </tag-desc> |
1019 | 1019 |
1020 <tag-name id="string_fromutf8"><literal>String.prototype.fromUTF8(<value>start</value>[, | 1020 <tag-name id="string_fromutf8"><literal>String.prototype.fromUTF8(<value>start</value>[, |
1021 <value>end</value>])</literal></tag-name> | 1021 <value>end</value>])</literal></tag-name> |
1022 <tag-desc> | 1022 <tag-desc> |
1023 Converts a byte string containing a valid UTF8 string | 1023 Converts a byte string containing a valid UTF-8 string |
1024 into a Unicode string, | 1024 into a Unicode string, |
1025 otherwise <literal>null</literal> is returned. | 1025 otherwise <literal>null</literal> is returned. |
1026 </tag-desc> | 1026 </tag-desc> |
1027 | 1027 |
1028 <tag-name id="string_tobytes"><literal>String.prototype.toBytes(<value>start</value>[, | 1028 <tag-name id="string_tobytes"><literal>String.prototype.toBytes(<value>start</value>[, |
1055 | 1055 |
1056 <tag-name id="string_toutf8"><literal>String.prototype.toUTF8(<value>start</value>[, | 1056 <tag-name id="string_toutf8"><literal>String.prototype.toUTF8(<value>start</value>[, |
1057 <value>end</value>])</literal></tag-name> | 1057 <value>end</value>])</literal></tag-name> |
1058 <tag-desc> | 1058 <tag-desc> |
1059 Serializes a Unicode string | 1059 Serializes a Unicode string |
1060 to a byte string using UTF8 encoding. | 1060 to a byte string using UTF-8 encoding. |
1061 <example> | 1061 <example> |
1062 >> 'αβγδ'.toUTF8().length | 1062 >> 'αβγδ'.toUTF8().length |
1063 8 | 1063 8 |
1064 >> 'αβγδ'.length | 1064 >> 'αβγδ'.length |
1065 4 | 1065 4 |