# HG changeset patch # User Artem Konev # Date 1597353635 -10800 # Node ID 2af7cdbadb20d6aaf4828a27cd439a21afeb0bd8 # Parent 2a2e4ef85e3b35239960be80b7b4f5cf83657287# Parent 7035221dbe375ea3511815bac0812986eb67776d Merged changes diff --git a/xml/en/docs/njs/changes.xml b/xml/en/docs/njs/changes.xml --- a/xml/en/docs/njs/changes.xml +++ b/xml/en/docs/njs/changes.xml @@ -9,7 +9,7 @@
@@ -63,7 +63,11 @@ introduced UTF-8 decoder according to Feature: -added TextEncoder/TextDecoder implementation. +added +TextDecoder() +and +TextEncoder() +implementation. diff --git a/xml/en/docs/njs/compatibility.xml b/xml/en/docs/njs/compatibility.xml --- a/xml/en/docs/njs/compatibility.xml +++ b/xml/en/docs/njs/compatibility.xml @@ -9,7 +9,7 @@
@@ -670,7 +670,8 @@ asynchronous version of file system meth -Query String methods +Query String +methods (0.4.3): querystring.decode, querystring.encode, @@ -680,6 +681,25 @@ asynchronous version of file system meth querystring.unescape + +TextDecoder +methods +(0.4.3): +encoding, +fatal, +ignoreBOM, +decode + + + +TextEncoder +methods +(0.4.3): +encoding, +encode, +encodeInto + + ES6 modules support: default export and diff --git a/xml/en/docs/njs/reference.xml b/xml/en/docs/njs/reference.xml --- a/xml/en/docs/njs/reference.xml +++ b/xml/en/docs/njs/reference.xml @@ -9,7 +9,7 @@
+ rev="53">
@@ -674,6 +674,155 @@ 4
+
+ + +The TextDecoder +produces a stream of code points +from a stream of bytes +(0.4.3). + + + + + +TextDecoder([[encoding], +options]) + +Creates a new TextDecoder object +for specified encoding, +currently, only UTF-8 is supported. +The options is +TextDecoderOptions dictionary with the property: + + + +fatal + +boolean flag indicating if +TextDecoder.decode() +must throw the TypeError exception when +a coding error is found, by default is false. + + + + + +TextDecoder.prototype.encoding + +Returns a string with the name of the encoding used by +TextDecoder(), +read-only. + + +TextDecoder.prototype.fatal + +boolean flag, true if +the error mode is fatal, +read-only. + + +TextDecoder.prototype.ignoreBOM + +boolean flag, true if +the byte order marker is ignored, +read-only. + + +TextDecoder.prototype.decode(buffer, +[options]) + +Returns a string with the text +decoded from the buffer by +TextDecoder(). +The buffer can be ArrayBuffer. +The options is +TextDecodeOptions dictionary with the property: + + + +stream + +boolean flag indicating if +additional data will follow in subsequent calls to decode(): +true if processing the data in chunks, and +false for the final chunk +or if the data is not chunked. +By default is false. + + + + +>> (new TextDecoder()).decode(new Uint8Array([206,177,206,178])) +αβ + + + + + + +
+ + +
+ + +The TextEncoder object +produces a byte stream with UTF-8 encoding +from a stream of code points +(0.4.3). + + + + + +TextEncoder() + +Returns a newly constructed TextEncoder +that will generate a byte stream with UTF-8 encoding. + + +TextEncoder.prototype.encoding + +Returns “utf-8”, read-only. + + +TextEncoder.prototype.encode(string) + +Encodes string into a Uint8Array +with UTF-8 encoded text. + + +TextEncoder.prototype.encodeInto(string, +uint8Array) + +Encodes a string to UTF-8, +puts the result into destination Uint8Array, and +returns a dictionary object that shows the progress of the encoding. +The dictionary object contains two members: + + + +read + +the number of UTF-16 units of code from the source string +converted to UTF-8 + + +written + +the number of bytes modified in the destination Uint8Array + + + + + + + + +
+ +
diff --git a/xml/ru/docs/njs/compatibility.xml b/xml/ru/docs/njs/compatibility.xml --- a/xml/ru/docs/njs/compatibility.xml +++ b/xml/ru/docs/njs/compatibility.xml @@ -9,7 +9,7 @@
@@ -666,7 +666,8 @@ ES5.1 global functions: -Методы Query String +Методы +Query String (0.4.3): querystring.decode, querystring.encode, @@ -676,6 +677,25 @@ ES5.1 global functions: querystring.unescape + +Методы +TextDecoder +(0.4.3): +encoding, +fatal, +ignoreBOM, +decode + + + +Методы +TextEncoder +(0.4.3): +encoding, +encode, +encodeInto + + ES6 поддержка модулей: инструкции diff --git a/xml/ru/docs/njs/reference.xml b/xml/ru/docs/njs/reference.xml --- a/xml/ru/docs/njs/reference.xml +++ b/xml/ru/docs/njs/reference.xml @@ -9,7 +9,7 @@
+ rev="53">
@@ -677,6 +677,155 @@ 4
+
+ + +Объект TextDecoder +создаёт поток кодовых точек из потока данных +(0.4.3). + + + + + +TextDecoder([[кодировка], +options]) + +Создаёт новый объект TextDecoder +для указанной кодировки, +на данный момент поддерживается только UTF-8. +Параметр options является +словарём TextDecoderOption со свойствами: + + + +fatal + +логический флаг, указывающий, что +TextDecoder.decode() +должен вызывать исключение TypeError в случае, если +найдена ошибка кодирования, по умолчанию false. + + + + + +TextDecoder.prototype.encoding + +Возвращает строку с именем кодировки, используемой +TextDecoder(), +только чтение. + + +TextDecoder.prototype.fatal + +логический флаг, true, если +генерируется ошибка для невалидных символов, +только чтение. + + +TextDecoder.prototype.ignoreBOM + +логический флаг, true, если +игнорируется маркер порядка следования байтов, +только чтение. + + +TextDecoder.prototype.decode(буфер, +[options]) + +Возвращает строку с текстом, +декодированным из буфера при помощи +TextDecoder(). +Буфером может быть +ArrayBuffer. +Параметром options является +словарь TextDecodeOptions со свойствами: + + + +stream + +логический флаг, указывающий, что +при последующих вызовах decode() +должны последовать дополнительные данные: +true, если данные обрабатываются блоками, и +false для последнего блока +или если данные не передаются блоками. +По умолчанию false. + + + + +>> (new TextDecoder()).decode(new Uint8Array([206,177,206,178])) +αβ + + + + + + +
+ + +
+ + +Объект TextEncoder +создаёт поток данных в кодировке UTF-8 +из потока кодовых точек +(0.4.3). + + + + + +TextEncoder() + +Возвращает только что созданный TextEncoder, +который создаёт поток данных в кодировке UTF-8. + + +TextEncoder.prototype.encoding + +Возвращает “utf-8”, только для чтения. + + +TextEncoder.prototype.encode(строка) + +Кодирует строку в Uint8Array, +содержащий текст в кодировке UTF-8. + + +TextEncoder.prototype.encodeInto(строка, +uint8Array) + +Преобразует строку в UTF-8, +сохраняет результат в целевом Uint8Array и +возвращает объект словаря, отражающий прогресс кодирования, со свойствами: + + + +read + +количество блоков кода UTF-16 из исходной строки, +преобразованных в UTF-8 + + +written + +количество байтов, преобразованных в целевом Uint8Array + + + + + + + + +
+ +