Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.
The utf-8 encoding is the most appropriate encoding for interchange of Unicode, the universal coded character set. Therefore for new protocols and formats, as well as existing formats deployed in new contexts, this specification requires (and defines) the utf-8 encoding.
The other (legacy) encodings have been defined to some extent in the past. However, user agents have not always implemented them in the same way, have not always used the same labels, and often differ in dealing with undefined and former proprietary areas of encodings. This specification addresses those gaps so that new user agents do not have to reverse engineer encoding implementations and existing user agents can converge.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document was published by the Internationalization Working Group as a Candidate Recommendation. This document is intended to become a W3C Recommendation.
W3C publishes a Candidate Recommendation to indicate that the document is believed to be stable and to encourage implementation by the developer community. W3C encourages everybody to implement this specification and return comments to the (archived) public mailing list<EMAIL_ADDRESS>(see instructions) or file a bug (open bugs). All comments are welcome. When sending e-mail, please put the text “Encoding” in the subject, preferably like this: “[Encoding] …summary of comment…” . This Candidate Recommendation is expected to advance to Proposed Recommendation no earlier than 16 March 2015. There is not yet an implementation report.
This is a snapshot of the WHATWG document, as of 4 September 2014, published after discussion with the WHATWG editors. No changes have been made in the body of this document other than to align with W3C house styles. The primary reason that W3C is publishing this document is so that HTML5 and other specifications may normatively refer to a stable W3C Recommendation.
This document takes into account comments during the Last Call; see Disposition of Comments for the Last Call. See a list of changes since the Last Call version was published. There are no features at risk.
Publication as a Candidate Recommendation does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document is governed by the 14 October 2005 W3C Process Document.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
The utf-8 encoding is the most appropriate encoding for interchange of Unicode, the universal coded character set. Therefore for new protocols and formats, as well as existing formats deployed in new contexts, this specification requires (and defines) the utf-8 encoding.
The other (legacy) encodings have been defined to some extent in the past. However, user agents have not always implemented them in the same way, have not always used the same labels, and often differ in dealing with undefined and former proprietary areas of encodings. This specification addresses those gaps so that new user agents do not have to reverse engineer encoding implementations and existing user agents can converge.
In particular, this specification defines all those encodings, their algorithms to go from bytes to scalar values and back, and their canonical names and identifying labels. This specification also defines an API to expose part of the encoding algorithms to JavaScript.
User agents have also significantly deviated from the labels listed in the IANA Character Sets registry. To stop spreading legacy encodings further, this specification is exhaustive about the aforementioned details and therefore has no need for the registry. In particular, this specification does not provide a mechanism for extending any aspect of encodings.
All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative.
The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC2119. For readability, these words do not appear in all uppercase letters in this specification. [RFC2119]
Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be easy to follow, and not intended to be performant.)
User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around platform-specific limitations.
Hexadecimal numbers are prefixed with "0x".
In equations, all numbers are integers, addition is represented by "+", subtraction by "−", multiplication by "×", division by "/", calculating the remainder of a division (also known as modulo) by "%", logical left shifts by "<<", logical right shifts by ">>", bitwise AND by "&", and bitwise OR by "|".
For logical right shifts operands must have at least twenty-one bits precision.
A byte is a sequence of eight bits, represented as a double-digit hexadecimal number in the range 0x00 to 0xFF.
A code point is a Unicode code point and is represented as a four-to-six digit hexadecimal number, typically prefixed with "U+". In equations and indexes code points are prefixed with "0x". [UNICODE]
A scalar value is a code point that is not in the range U+D800 to U+DFFF.
The ASCII whitespace are code points U+0009, U+000A, U+000C, U+000D, and U+0020.
The ASCII digits are code points in the range U+0030 to U+0039.
A string is a sequence of code points.
Comparing two strings in an ASCII case-insensitive manner means comparing them exactly, code point for code point, except that the characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z) and the corresponding characters in the range U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL LETTER Z) are considered to also match.
A token is a piece of data, such as a byte or code point.
A stream represents an ordered sequence of tokens. End-of-stream is a special token that signifies no more tokens are in the stream.
When a token is read from a stream, the first token in the stream must be returned and subsequently removed, and end-of-stream must be returned otherwise.
When one or more tokens are prepended to a stream, those tokens must be inserted, in given order, before the first token in the stream.
Inserting the sequence of tokens 💩
in a
stream " hello world
", results in a stream
"💩 hello world
". The next token to be read would be
&
.
When one or more tokens are pushed to a stream, those tokens must be inserted, in given order, after the last token in the stream.
An encoding defines a mapping from a scalar value sequence to a byte sequence (and vice versa). Each encoding has a name, and one or more labels.
Each encoding has an associated decoder and encoder. Each decoder and encoder have a handler algorithm. A handler algorithm takes an input stream and a token, and returns finished, one or more tokens, error optionally with a code point, or continue.
An error mode as used below is either replacement (default) or fatal for a decoder and one of fatal (default) or HTML for an encoder.
An XML processor would set error mode to fatal. [XML]
HTML exists as error mode due to URLs and HTML forms requiring a non-terminating legacy encoder. The HTML error mode causes a sequence to be emitted that cannot be distinguished from legitimate input and can therefore lead to silent data loss. Developers are strongly encouraged to use the utf-8 encoding to prevent this from happening. [URL] [HTML]
To run an encoding's decoder or encoder encoderDecoder with input stream input, output stream output, and error mode mode, run these steps:
If mode is not given, set it to replacement, if encoderDecoder is a decoder, and fatal otherwise.
Let encoderDecoderInstance be a new encoderDecoder.
While true:
Let result be the result of processing the result of reading from input for encoderDecoderInstance, input, output, and mode.
If result is not continue, return result.
Otherwise, do nothing.
To process a token token for an encoding's encoder or decoder instance encoderDecoderInstance, stream input, output stream output, and error mode mode, run these steps:
If mode is not given, set it to replacement, if encoderDecoder is a decoder instance, and fatal otherwise.
Let result be the result of running encoderDecoderInstance's handler on token.
Otherwise, if result is one or more tokens, push result to output.
Otherwise, if result is error, switch on mode and run the associated steps:
The table below lists all encodings and their labels user agents must support. User agents must not support any other encodings or labels.
Authors must use the utf-8 encoding and must use the
ASCII case-insensitive "utf-8
" label to
identify it.
New protocols and formats, as well as existing formats deployed in new contexts, must
use the utf-8 encoding exclusively. If these protocols and
formats need to expose the encoding's name or
label, they must expose it as "utf-8
".
To get an encoding from a string label, run these steps:
Remove any leading and trailing ASCII whitespace from label.
If label is an ASCII case-insensitive match for any of the labels listed in the table below, return the corresponding encoding, and failure otherwise.
This is a much simpler and more restrictive algorithm of mapping labels to encodings than section 1.4 of Unicode Technical Standard #22 prescribes, as that is found to be necessary to be compatible with deployed content.
| Name | Labels |
|---|---|
| The Encoding | |
| utf-8 | "unicode-1-1-utf-8 "
|
"utf-8 "
| |
"utf8 "
| |
| Legacy single-byte encodings | |
| ibm866 | "866 "
|
"cp866 "
| |
"csibm866 "
| |
"ibm866 "
| |
| iso-8859-2 | "csisolatin2 "
|
"iso-8859-2 "
| |
"iso-ir-101 "
| |
"iso8859-2 "
| |
"iso88592 "
| |
"iso_8859-2 "
| |
"iso_8859-2:1987 "
| |
"l2 "
| |
"latin2 "
| |
| iso-8859-3 | "csisolatin3 "
|
"iso-8859-3 "
| |
"iso-ir-109 "
| |
"iso8859-3 "
| |
"iso88593 "
| |
"iso_8859-3 "
| |
"iso_8859-3:1988 "
| |
"l3 "
| |
"latin3 "
| |
| iso-8859-4 | "csisolatin4 "
|
"iso-8859-4 "
| |
"iso-ir-110 "
| |
"iso8859-4 "
| |
"iso88594 "
| |
"iso_8859-4 "
| |
"iso_8859-4:1988 "
| |
"l4 "
| |
"latin4 "
| |
| iso-8859-5 | "csisolatincyrillic "
|
"cyrillic "
| |
"iso-8859-5 "
| |
"iso-ir-144 "
| |
"iso8859-5 "
| |
"iso88595 "
| |
"iso_8859-5 "
| |
"iso_8859-5:1988 "
| |
| iso-8859-6 | "arabic "
|
"asmo-708 "
| |
"csiso88596e "
| |
"csiso88596i "
| |
"csisolatinarabic "
| |
"ecma-114 "
| |
"iso-8859-6 "
| |
"iso-8859-6-e "
| |
"iso-8859-6-i "
| |
"iso-ir-127 "
| |
"iso8859-6 "
| |
"iso88596 "
| |
"iso_8859-6 "
| |
"iso_8859-6:1987 "
| |
| iso-8859-7 | "csisolatingreek "
|
"ecma-118 "
| |
"elot_928 "
| |
"greek "
| |
"greek8 "
| |
"iso-8859-7 "
| |
"iso-ir-126 "
| |
"iso8859-7 "
| |
"iso88597 "
| |
"iso_8859-7 "
| |
"iso_8859-7:1987 "
| |
"sun_eu_greek "
| |
| iso-8859-8 | "csiso88598e "
|
"csisolatinhebrew "
| |
"hebrew "
| |
"iso-8859-8 "
| |
"iso-8859-8-e "
| |
"iso-ir-138 "
| |
"iso8859-8 "
| |
"iso88598 "
| |
"iso_8859-8 "
| |
"iso_8859-8:1988 "
| |
"visual "
| |
| iso-8859-8-i | "csiso88598i "
|
"iso-8859-8-i "
| |
"logical "
| |
| iso-8859-10 | "csisolatin6 "
|
"iso-8859-10 "
| |
"iso-ir-157 "
| |
"iso8859-10 "
| |
"iso885910 "
| |
"l6 "
| |
"latin6 "
| |
| iso-8859-13 | "iso-8859-13 "
|
"iso8859-13 "
| |
"iso885913 "
| |
| iso-8859-14 | "iso-8859-14 "
|
"iso8859-14 "
| |
"iso885914 "
| |
| iso-8859-15 | "csisolatin9 "
|
"iso-8859-15 "
| |
"iso8859-15 "
| |
"iso885915 "
| |
"iso_8859-15 "
| |
"l9 "
| |
| iso-8859-16 | "iso-8859-16 "
|
| koi8-r | "cskoi8r "
|
"koi "
| |
"koi8 "
| |
"koi8-r "
| |
"koi8_r "
| |
| koi8-u | "koi8-u "
|
| macintosh | "csmacintosh "
|
"mac "
| |
"macintosh "
| |
"x-mac-roman "
| |
| windows-874 | "dos-874 "
|
"iso-8859-11 "
| |
"iso8859-11 "
| |
"iso885911 "
| |
"tis-620 "
| |
"windows-874 "
| |
| windows-1250 | "cp1250 "
|
"windows-1250 "
| |
"x-cp1250 "
| |
| windows-1251 | "cp1251 "
|
"windows-1251 "
| |
"x-cp1251 "
| |
| windows-1252 | "ansi_x3.4-1968 "
|
"ascii "
| |
"cp1252 "
| |
"cp819 "
| |
"csisolatin1 "
| |
"ibm819 "
| |
"iso-8859-1 "
| |
"iso-ir-100 "
| |
"iso8859-1 "
| |
"iso88591 "
| |
"iso_8859-1 "
| |
"iso_8859-1:1987 "
| |
"l1 "
| |
"latin1 "
| |
"us-ascii "
| |
"windows-1252 "
| |
"x-cp1252 "
| |
| windows-1253 | "cp1253 "
|
"windows-1253 "
| |
"x-cp1253 "
| |
| windows-1254 | "cp1254 "
|
"csisolatin5 "
| |
"iso-8859-9 "
| |
"iso-ir-148 "
| |
"iso8859-9 "
| |
"iso88599 "
| |
"iso_8859-9 "
| |
"iso_8859-9:1989 "
| |
"l5 "
| |
"latin5 "
| |
"windows-1254 "
| |
"x-cp1254 "
| |
| windows-1255 | "cp1255 "
|
"windows-1255 "
| |
"x-cp1255 "
| |
| windows-1256 | "cp1256 "
|
"windows-1256 "
| |
"x-cp1256 "
| |
| windows-1257 | "cp1257 "
|
"windows-1257 "
| |
"x-cp1257 "
| |
| windows-1258 | "cp1258 "
|
"windows-1258 "
| |
"x-cp1258 "
| |
| x-mac-cyrillic | "x-mac-cyrillic "
|
"x-mac-ukrainian "
| |
| Legacy multi-byte Chinese (simplified) encodings | |
| gb18030 | "chinese "
|
"csgb2312 "
| |
"csiso58gb231280 "
| |
"gb18030 "
| |
"gb2312 "
| |
"gb_2312 "
| |
"gb_2312-80 "
| |
"gbk "
| |
"iso-ir-58 "
| |
"x-gbk "
| |
| hz-gb-2312 | "hz-gb-2312 "
|
| Legacy multi-byte Chinese (traditional) encodings | |
| big5 | "big5 "
|
"big5-hkscs "
| |
"cn-big5 "
| |
"csbig5 "
| |
"x-x-big5 "
| |
| Legacy multi-byte Japanese encodings | |
| euc-jp | "cseucpkdfmtjapanese "
|
"euc-jp "
| |
"x-euc-jp "
| |
| iso-2022-jp | "csiso2022jp "
|
"iso-2022-jp "
| |
| shift_jis | "csshiftjis "
|
"ms_kanji "
| |
"shift-jis "
| |
"shift_jis "
| |
"sjis "
| |
"windows-31j "
| |
"x-sjis "
| |
| Legacy multi-byte Korean encodings | |
| euc-kr | "cseuckr "
|
"csksc56011987 "
| |
"euc-kr "
| |
"iso-ir-149 "
| |
"korean "
| |
"ks_c_5601-1987 "
| |
"ks_c_5601-1989 "
| |
"ksc5601 "
| |
"ksc_5601 "
| |
"windows-949 "
| |
| Legacy miscellaneous encodings | |
| replacement | "csiso2022kr "
|
"iso-2022-cn "
| |
"iso-2022-cn-ext "
| |
"iso-2022-kr "
| |
| utf-16be | "utf-16be "
|
| utf-16le | "utf-16 "
|
"utf-16le "
| |
| x-user-defined | "x-user-defined "
|
All encodings and their labels are also available as non-normative encodings.json resource.
Most legacy encodings make use of an index. An index is an ordered list of pointers and corresponding code points. Within an index pointers are unique and code points can be duplicated.
An efficient implementation likely has two indexes per encoding. One optimized for its decoder and one for its encoder.
To find the pointers and their corresponding code points in an index, let lines be the result of splitting the resource's contents on U+000A. Then remove each item in lines that is the empty string or starts with U+0023. Then the pointers and their corresponding code points are found by splitting each item in lines on U+0009. The first subitem is the pointer (as a decimal number) and the second is the corresponding code point (as a hexadecimal number). Other subitems are not relevant.
To signify changes an index includes an Identifier and a Date. If an Identifier has changed, so has the index.
The index code point for pointer in index is the code point corresponding to pointer in index, or null if pointer is not in index.
The index pointer for code point in index is the first pointer corresponding to code point in index, or null if code point is not in index.
These are the indexes defined by this specification, excluding index single-byte, which have their own table:
| Index | Notes | |
|---|---|---|
| index big5 | index-big5.txt | This matches the Big5 standard in combination with the Hong Kong Supplementary Character Set and other common extensions. |
| index euc-kr | index-euc-kr.txt | This matches the KS X 1001 standard and the Unified Hangul Code, more commonly known together as Windows Codepage 949. |
| index gb18030 | index-gb18030.txt | This matches the GB18030 standard for code points encoded as two bytes, except 0xA3 0xA0 maps to U+3000 to be compatible with deployed content. |
| index gb18030 ranges | index-gb18030-ranges.txt | This index works different from all others. Listing all code points would result in over a million items whereas they can be represented neatly in 207 ranges combined with trivial limit checks. It therefore only superficially matches the GB18030 standard for code points encoded as four bytes. See also index gb18030 ranges code point and index gb18030 ranges pointer below. |
| index jis0208 | index-jis0208.txt | This is the JIS X 0208 standard including formerly proprietary extensions from IBM and NEC. |
| index jis0212 | index-jis0212.txt | This is the JIS X 0212 standard. |
The index gb18030 ranges code point for pointer is the return value of these steps:
If pointer is greater than 39419 and less than 189000, or pointer is greater than 1237575, return null.
Let offset be the last pointer in index gb18030 ranges that is equal to or less than pointer and let code point offset be its corresponding code point.
Return a code point whose value is code point offset + pointer − offset.
The index gb18030 ranges pointer for code point is the return value of these steps:
Let offset be the last code point in index gb18030 ranges that is equal to or less than code point and let pointer offset be its corresponding pointer.
Return a pointer whose value is pointer offset + code point − offset.
The index shift_jis pointer for code point is the return value of these steps:
Let index be index jis0208 excluding all pointers in the range 8272 to 8835.
Return the index pointer for code point in index.
All indexes are also available as non-normative indexes.json resource. (index gb18030 ranges has a slightly different format here, to be able to represent ranges.)
The algorithms decode, utf-8 decode, utf-8 decode without BOM, encode, and utf-8 encode are intended for usage by other specifications. utf-8 decode is to be used by new formats. The get an encoding algorithm can be used first to turn a label into an encoding.
To decode a byte stream stream using fallback encoding encoding, run these steps:
Let buffer be an empty byte sequence.
Let BOM seen flag be unset.
Read bytes from stream into buffer until either buffer contains three bytes or read returns end-of-stream.
For each of the rows in the table below, starting with the first one and going down, if the first bytes of buffer match all the bytes given in the first column, then set encoding to the encoding given in the cell in the second column of that row and set BOM seen flag.
| Byte order mark | Encoding |
|---|---|
| 0xEF 0xBB 0xBF | utf-8 |
| 0xFE 0xFF | utf-16be |
| 0xFF 0xFE | utf-16le |
For compatibility with deployed content, the byte order mark (also known as BOM) is considered more authoritative than anything else.
If BOM seen flag is unset prepend buffer to stream.
Otherwise, if BOM seen flag is set, encoding is not utf-8, and buffer contains three bytes, prepend the last byte of buffer to stream.
Let output be a code point stream.
Return output.
To utf-8 decode a byte stream stream, run these steps:
Let buffer be an empty byte sequence.
Read three bytes from stream into buffer.
If buffer does not match 0xEF 0xBB 0xBF, prepend buffer to stream.
Let output be a code point stream.
Return output.
To utf-8 decode without BOM a byte stream stream, run these steps:
To encode a code point stream stream using encoding encoding, run these steps:
This is mostly a legacy hook for URLs and HTML forms. Layering utf-8 encode on top is safe as it never triggers errors. [URL] [HTML]
To utf-8 encode a code point stream stream, return the result of encoding stream using encoding utf-8.
If the input to encode or utf-8 encode stems from a DOMString, the convert a DOMString to a sequence of Unicode characters from Web IDL is to be used first.
This section uses terminology from the DOM and Web IDL. Non-browser user agents are not required to support this API. [DOM] [WEBIDL]
The following example uses the TextEncoder
object to encode
an array of strings into an
ArrayBuffer
. The result is a
Uint8Array
containing the number
of strings (as a Uint32Array
),
followed by the length of the first string (as a
Uint32Array
), the
utf-8 encoded string data, the length of the second string (as
a Uint32Array
), the string data,
and so on.
function encodeArrayOfStrings(strings, encoding) {
var encoder, encoded, len, i, bytes, view, offset;
encoder = new TextEncoder(encoding);
encoded = [];
len = Uint32Array.BYTES_PER_ELEMENT;
for (i = 0; i < strings.length; i += 1) {
len += Uint32Array.BYTES_PER_ELEMENT;
encoded[i] = new TextEncoder(encoding).encode(strings[i]);
len += encoded[i].byteLength;
}
bytes = new Uint8Array(len);
view = new DataView(bytes.buffer);
offset = 0;
view.setUint32(offset, strings.length);
offset += Uint32Array.BYTES_PER_ELEMENT;
for (i = 0; i < encoded.length; i += 1) {
len = encoded[i].byteLength;
view.setUint32(offset, len);
offset += Uint32Array.BYTES_PER_ELEMENT;
bytes.set(encoded[i], offset);
offset += len;
}
return bytes.buffer;
}
The following example decodes an
ArrayBuffer
containing data
encoded in the format produced by the previous example back into an array
of strings.
function decodeArrayOfStrings(buffer, encoding) {
var decoder, view, offset, num_strings, strings, i, len;
decoder = new TextDecoder(encoding);
view = new DataView(buffer);
offset = 0;
strings = [];
num_strings = view.getUint32(offset);
offset += Uint32Array.BYTES_PER_ELEMENT;
for (i = 0; i < num_strings; i += 1) {
len = view.getUint32(offset);
offset += Uint32Array.BYTES_PER_ELEMENT;
strings[i] = decoder.decode(
new DataView(view.buffer, offset, len));
offset += len;
}
return strings;
}
ScalarValueString
This is a temporary definition until IDL proper is updated to include it.
typedef
is used for now to keep IDL validity.
typedef DOMString ScalarValueString;
ScalarValueString
is identical to DOMString except that
convert a DOMString to a sequence of Unicode characters
is used subsequently when converting to an IDL value. Ergo, the IDL value is a sequence
of scalar values.
Only use ScalarValueString
if the subsystem deals in
scalar values rather than
code points. When in doubt, use
DOMString
.
TextDecoder
dictionary TextDecoderOptions { boolean fatal = false; boolean ignoreBOM = false; }; dictionary TextDecodeOptions { boolean stream = false; }; [Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options), Exposed=Window,Worker] interface TextDecoder { readonly attribute DOMString encoding; readonly attribute boolean fatal; readonly attribute boolean ignoreBOM; DOMString decode(optional ArrayBufferView input, optional TextDecodeOptions options); };
A TextDecoder
object has an associated encoding, decoder,
stream, ignore BOM flag (initially unset),
BOM seen flag (initially unset),
error mode (initially replacement), and
streaming flag (initially unset).
A TextDecoder
object also has an associated
serialize stream algorithm, that given a
stream stream, runs these steps:
Let output be the empty string.
While true:
Let token be the result of reading from stream.
If encoding is one of utf-8, utf-16be, and utf-16le, and ignore BOM flag and BOM seen flag are unset, run these subsubsteps:
If token is U+FEFF, set BOM seen flag.
Otherwise, if token is not end-of-stream, set BOM seen flag and append token to output.
Otherwise, return output.
Otherwise, if token is not end-of-stream, append token to output.
Otherwise, return output.
This algorithm is intentionally different with respect to BOM handling from the decode algorithm used by the rest of the platform to give API users more control.
decoder = new TextDecoder([label = "utf-8" [, options]])
Returns a new TextDecoder
object.
If label is either not a label or is a
label for replacement,
throws a
TypeError
.
decoder . encoding
Returns encoding's name.
fatal . fatal
Returns true if error mode is fatal, and false otherwise.
ignoreBOM . ignoreBOM
Returns true if ignore BOM flag is set, and false otherwise.
decoder . decode([input [, options]])
Returns the result of running encoding's
decoder. If options's
stream
is set to true the method can be invoked
multiple times to process a fragmented stream.
If the error mode is fatal set and encoding's
decoder returns error,
throws an
"EncodingError
".
The
TextDecoder(label, options)
constructor must run these steps:
Let encoding be the result of getting an encoding from label.
If encoding is failure or replacement,
throw a TypeError
.
Let dec be a new TextDecoder
object.
Set dec's encoding to encoding.
If options's fatal
member is
true, set dec's error mode to fatal.
If options's ignoreBOM
member is
true, set dec's ignore BOM flag.
Return dec.
The encoding
attribute must
return encoding's name.
The fatal
attribute must
return true if error mode is fatal, and false otherwise.
The ignoreBOM
attribute must
return true if ignore BOM flag is set, and false otherwise.
The
decode(input, options)
method must run these steps:
If the streaming flag is unset, set decoder to a new encoding's decoder, set stream to a new stream, and unset the BOM seen flag.
If options's stream
is true, set the
streaming flag, and unset the streaming flag otherwise.
If input is given, then given
input's buffer
,
byteOffset
, and byteLength
,
push byteLength
bytes from
buffer
, starting at byteOffset
, to stream.
Let output be a new stream.
While true:
Let token be the result of reading from stream.
If token is end-of-stream and the streaming flag is set, return output, serialized.
Otherwise, run these subsubsteps:
Let result be the result of processing token for decoder, stream, output, and error mode.
If result is finished, return output, serialized.
Otherwise, do nothing.
TextEncoder
[Constructor(optional DOMString utfLabel = "utf-8"), Exposed=Window,Worker] interface TextEncoder { readonly attribute DOMString encoding; Uint8Array encode(optional ScalarValueString input = ""); };
A TextEncoder
object has an associated encoding and encoder.
encoder = new TextEncoder([utfLabel = "utf-8"])
Returns a new TextEncoder
object.
If utfLabel is not a label for
utf-8, utf-16be, or utf-16le,
throws a
TypeError
.
encoder . encoding
Returns encoding's name.
encoder . encode([input = ""])
Returns the result of running encoding's
encoder. If options's
stream
is set to true, the method can be invoked
multiple times to process a fragmented stream.
The
TextEncoder(utfLabel)
constructor must run these steps:
Let encoding be the result of getting an encoding from utfLabel.
If encoding is failure, or is none of
utf-8, utf-16be, and utf-16le,
throw a TypeError
.
Let enc be a new TextEncoder
object.
Set enc's encoding to encoding.
Set enc's encoder to a new enc's encoding's encoder.
Return enc.
The encoding
attribute must return encoding's name.
The
encode(input, options)
method must run these steps:
Convert input to a stream.
Let output be a new stream.
While true, run these substeps:
Let token be the result of reading from input.
Let result be the result of processing token for encoder, input, output.
If result is finished, convert output into a
byte sequence, and then return a Uint8Array
object wrapping an
ArrayBuffer
containing output.
utf-8's decoder's has an associated utf-8 code point, utf-8 bytes seen, and utf-8 bytes needed (all initially 0), a utf-8 lower boundary (initially 0x80), and a utf-8 upper boundary (initially 0xBF).
utf-8's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream and utf-8 bytes needed is not 0, set utf-8 bytes needed to 0 and return error.
If byte is end-of-stream, return finished.
If utf-8 bytes needed is 0, based on byte:
Return a code point whose value is byte.
Set utf-8 bytes needed to 1 and utf-8 code point to byte − 0xC0.
If byte is 0xE0, set utf-8 lower boundary to 0xA0.
If byte is 0xED, set utf-8 upper boundary to 0x9F.
Set utf-8 bytes needed to 2 and utf-8 code point to byte − 0xE0.
If byte is 0xF0, set utf-8 lower boundary to 0x90.
If byte is 0xF4, set utf-8 upper boundary to 0x8F.
Set utf-8 bytes needed to 3 and utf-8 code point to byte − 0xF0.
Return error.
Then (byte is in the range 0xC2 to 0xF4) set utf-8 code point to utf-8 code point << (6 × utf-8 bytes needed) and return continue.
If byte is not in the range utf-8 lower boundary to utf-8 upper boundary, run these substeps:
Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes seen to 0, set utf-8 lower boundary to 0x80, and set utf-8 upper boundary to 0xBF.
Prepend byte to stream.
Return error.
Set utf-8 lower boundary to 0x80 and utf-8 upper boundary to 0xBF.
Increase utf-8 bytes seen by one and set utf-8 code point to utf-8 code point + (byte − 0x80) << (6 × (utf-8 bytes needed − utf-8 bytes seen)).
If utf-8 bytes seen is not equal to utf-8 bytes needed, continue.
Let code point be utf-8 code point.
Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes seen to 0.
Emit a code point whose value is code point.
The constraints in the utf-8 decoder above match “Best Practices for Using U+FFFD” from the Unicode standard. No other behavior is permitted per the Encoding Standard (other algorithms that achieve the same result are obviously fine, even encouraged).
utf-8's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
Set count and offset based on the range code point is in:
Let bytes be a byte sequence whose first byte is (code point >> (6 × count)) + offset.
Run these substeps while count is greater than 0:
Set temp to code point >> (6 × (count − 1)).
Append to bytes 0x80 | (temp & 0x3F).
Decrease count by one.
Return bytes bytes, in order.
An encoding where each byte is either a single code point or nothing, is a single-byte encoding. Single-byte encodings share the decoder and encoder. Index single-byte, as referenced by the single-byte decoder and single-byte encoder, is defined by the following table, and depends on the single-byte encoding in use. All but two single-byte encodings have a unique index.
| Name | Index |
|---|---|
| ibm866 | index-ibm866.txt |
| iso-8859-2 | index-iso-8859-2.txt |
| iso-8859-3 | index-iso-8859-3.txt |
| iso-8859-4 | index-iso-8859-4.txt |
| iso-8859-5 | index-iso-8859-5.txt |
| iso-8859-6 | index-iso-8859-6.txt |
| iso-8859-7 | index-iso-8859-7.txt |
| iso-8859-8 | index-iso-8859-8.txt |
| iso-8859-8-i | |
| iso-8859-10 | index-iso-8859-10.txt |
| iso-8859-13 | index-iso-8859-13.txt |
| iso-8859-14 | index-iso-8859-14.txt |
| iso-8859-15 | index-iso-8859-15.txt |
| iso-8859-16 | index-iso-8859-16.txt |
| koi8-r | index-koi8-r.txt |
| koi8-u | index-koi8-u.txt |
| macintosh | index-macintosh.txt |
| windows-874 | index-windows-874.txt |
| windows-1250 | index-windows-1250.txt |
| windows-1251 | index-windows-1251.txt |
| windows-1252 | index-windows-1252.txt |
| windows-1253 | index-windows-1253.txt |
| windows-1254 | index-windows-1254.txt |
| windows-1255 | index-windows-1255.txt |
| windows-1256 | index-windows-1256.txt |
| windows-1257 | index-windows-1257.txt |
| windows-1258 | index-windows-1258.txt |
| x-mac-cyrillic | index-x-mac-cyrillic.txt |
iso-8859-8 and iso-8859-8-i are distinct encoding names, because iso-8859-8 has influence on the layout direction. And although historically this might have been the case for iso-8859-6 and "iso-8859-6-i" as well, that is no longer true.
Single-byte encodings's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream, return finished.
If byte is in the range 0x00 to 0x7F, return a code point whose value is byte.
Let code point be the index code point for byte − 0x80 in index single-byte.
If code point is null, return error.
Return a code point whose value is code point.
Single-byte encodings's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
Let pointer be the index pointer for code point in index single-byte.
If pointer is null, return error with code point.
Return a byte whose value is pointer + 0x80.
gb18030's decoder has an associated gb18030 first, gb18030 second, and gb18030 third (all initially 0x00).
gb18030's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream and gb18030 first, gb18030 second, and gb18030 third are 0x00, return finished.
If byte is end-of-stream, and gb18030 first, gb18030 second, or gb18030 third is not 0x00, set gb18030 first, gb18030 second, and gb18030 third to 0x00, and return error.
If gb18030 third is not 0x00, run these substeps:
Let code point be null.
If byte is in the range 0x30 to 0x39, set code point to the index gb18030 ranges code point for (((gb18030 first − 0x81) × 10 + gb18030 second − 0x30) × 126 + gb18030 third − 0x81) × 10 + byte − 0x30.
Let buffer be a byte sequence consisting of gb18030 second, gb18030 third, and byte, in order.
Set gb18030 first, gb18030 second, and gb18030 third to 0x00.
If code point is null, prepend buffer to stream and return error.
Return a code point whose value is code point.
If gb18030 second is not 0x00, run these substeps:
If byte is in the range 0x81 to 0xFE, set gb18030 third to byte and return continue.
Prepend gb18030 second followed by byte to stream, set gb18030 first and gb18030 second to 0x00, and return error.
If gb18030 first is not 0x00, run these substeps:
If byte is in the range 0x30 to 0x39, set gb18030 second to byte and return continue.
Let lead be gb18030 first, let pointer be null, and set gb18030 first to 0x00.
Let offset be 0x40 if byte is less than 0x7F and 0x41 otherwise.
If byte is in the range 0x40 to 0x7E or 0x80 to 0xFE, set pointer to (lead − 0x81) × 190 + (byte − offset).
Let code point be null if pointer is null and the index code point for pointer in index gb18030 otherwise.
If pointer is null, prepend byte to stream.
If code point is null, return error.
Return a code point whose value is code point.
If byte is in the range 0x00 to 0x7F, return a code point whose value is byte.
If byte is 0x80, return code point U+20AC.
If byte is in the range 0x81 to 0xFE, set gb18030 first to byte and return continue.
Return error.
gb18030's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
Let pointer be the index pointer for code point in index gb18030.
If pointer is not null, run these substeps:
Let lead be pointer / 190 + 0x81.
Let trail be pointer % 190.
Let offset be 0x40 if trail is less than 0x3F and 0x41 otherwise.
Return two bytes whose values are lead and trail + offset.
Set pointer to the index gb18030 ranges pointer for code point.
Let byte1 be pointer / 10 / 126 / 10.
Set pointer to pointer − byte1 × 10 × 126 × 10.
Let byte2 be pointer / 10 / 126.
Set pointer to pointer − byte2 × 10 × 126.
Let byte3 be pointer / 10.
Let byte4 be pointer − byte3 × 10.
Return four bytes whose values are byte1 + 0x81, byte2 + 0x30, byte3 + 0x81, byte4 + 0x30.
This encoding is considered for removal.
hz-gb-2312's decoder has an associated hz-gb-2312 flag (initially unset) and hz-gb-2312 lead (initially 0x00).
hz-gb-2312's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream and hz-gb-2312 lead is not 0x00, set hz-gb-2312 lead to 0x00 and return error.
If byte is end-of-stream and hz-gb-2312 lead is 0x00, return finished.
If hz-gb-2312 lead is 0x7E, set hz-gb-2312 lead to 0x00, and based on byte:
Set the hz-gb-2312 flag and return continue.
Unset the hz-gb-2312 flag and return continue.
Return code point U+007E.
Return continue.
If hz-gb-2312 lead is not 0x00, let lead be hz-gb-2312 lead, set hz-gb-2312 lead to 0x00, and then run these substeps:
If byte is in the range 0x21 to 0x7E, let code point be the index code point for (lead − 1) × 190 + (byte + 0x3F) in index gb18030.
If byte is 0x0A, unset the hz-gb-2312 flag.
If code point is null, return error.
Return a code point whose value is code point.
If byte is 0x7E, set hz-gb-2312 lead to 0x7E and return continue.
If the hz-gb-2312 flag is set:
If byte is in the range 0x20 to 0x7F, set hz-gb-2312 lead to byte and return continue.
If byte is 0x0A, unset the hz-gb-2312 flag.
Return error.
If byte is in the range 0x00 to 0x7F, return a code point whose value is byte.
Return error.
hz-gb-2312's encoder has an associated hz-gb-2312 flag.
hz-gb-2312's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F and the hz-gb-2312 flag is set, prepend code point to stream, unset the hz-gb-2312 flag, and return two bytes 0x7E 0x7D.
If code point is 0x007E, return two bytes 0x7E 0x7E.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
Let pointer be the index pointer for code point in index gb18030.
If pointer is null, return error with code point.
If the hz-gb-2312 flag is unset, prepend code point to stream, set the hz-gb-2312 flag, and return two bytes 0x7E 0x7B.
Let lead be pointer / 190 + 1.
Let trail be pointer % 190 − 0x3F.
If either lead or trail is less than 0x21, return error with code point.
Return two bytes whose values are lead and trail.
big5's decoder has an associated big5 lead (initially 0x00). big5's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream and big5 lead is not 0x00, set big5 lead to 0x00 and return error.
If byte is end-of-stream and big5 lead is 0x00, return finished.
If big5 lead is not 0x00, let lead be big5 lead, let pointer be null, set big5 lead to 0x00, and then run these substeps:
Let offset be 0x40 if byte is less than 0x7F and 0x62 otherwise.
If byte is in the range 0x40 to 0x7E or 0xA1 to 0xFE, set pointer to (lead − 0x81) × 157 + (byte − offset).
If there is a row in the table below whose first column is pointer, return the two code points listed in its second column (the third column is irrelevant):
| Pointer | Code points | Notes |
|---|---|---|
| 1133 | U+00CA U+0304 | Ê̄ (LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND MACRON) |
| 1135 | U+00CA U+030C | Ê̌ (LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND CARON) |
| 1164 | U+00EA U+0304 | ê̄ (LATIN SMALL LETTER E WITH CIRCUMFLEX AND MACRON) |
| 1166 | U+00EA U+030C | ê̌ (LATIN SMALL LETTER E WITH CIRCUMFLEX AND CARON) |
Since indexes are limited to single code points this table is used for these pointers.
Let code point be null if pointer is null and the index code point for pointer in index big5 otherwise.
If pointer is null and byte is in the range 0x00 to 0x7F, prepend byte to stream.
If code point is null, return error.
Return a code point whose value is code point.
If byte is in the range 0x00 to 0x7F, return a code point whose value is byte.
If byte is in the range 0x81 to 0xFE, set big5 lead to byte and return continue.
Return error.
big5's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
Let pointer be the index pointer for code point in index big5.
If pointer is null, return error with code point.
Let lead be pointer / 157 + 0x81.
If lead is less than 0xA1, return error with code point.
Avoid returning Hong Kong Supplementary Character Set extensions literally.
Let trail be pointer % 157.
Let offset be 0x40 if trail is less than 0x3F and 0x62 otherwise.
Return two bytes whose values are lead and trail + offset.
euc-jp's decoder has an associated euc-jp jis0212 flag (initially unset) and euc-jp lead (initially 0x00).
euc-jp's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream and euc-jp lead is not 0x00, set euc-jp lead to 0x00, and return error.
If byte is end-of-stream and euc-jp lead is 0x00, return finished.
If euc-jp lead is 0x8E and byte is in the range 0xA1 to 0xDF, set euc-jp lead to 0x00 and return a code point whose value is 0xFF61 + byte − 0xA1.
If euc-jp lead is 0x8F and byte is in the range 0xA1 to 0xFE, set the euc-jp jis0212 flag, set euc-jp lead to byte, and return continue.
If euc-jp lead is not 0x00, let lead be euc-jp lead, set euc-jp lead to 0x00, and run these substeps:
Let code point be null.
If lead and byte are both in the range 0xA1 to 0xFE, set code point to the index code point for (lead − 0xA1) × 94 + byte − 0xA1 in index jis0208 if the euc-jp jis0212 flag is unset and in index jis0212 otherwise.
Unset the euc-jp jis0212 flag.
If byte is not in the range 0xA1 to 0xFE, prepend byte to stream.
If code point is null, return error.
Return a code point whose value is code point.
If byte is in the range 0x00 to 0x7F, return a code point whose value is byte.
If byte is 0x8E, 0x8F, or in the range 0xA1 to 0xFE, set euc-jp lead to byte and return continue.
Return error.
euc-jp's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
If code point is U+00A5, return byte 0x5C.
If code point is U+203E, return byte 0x7E.
If code point is in the range U+FF61 to U+FF9F, return two bytes whose values are 0x8E and code point − 0xFF61 + 0xA1.
Let pointer be the index pointer for code point in index jis0208.
If pointer is null, return error with code point.
Let lead be pointer / 94 + 0xA1.
Let trail be pointer % 94 + 0xA1.
Return two bytes whose values are lead and trail.
The index jis0212 is not used by the euc-jp encoder due to lack of widespread support.
iso-2022-jp's decoder has an associated iso-2022-jp state (initially ASCII state), iso-2022-jp jis0212 flag (initially unset), and iso-2022-jp lead (initially 0x00).
iso-2022-jp's decoder's handler, given a stream and byte, runs these steps, switching on iso-2022-jp state:
Based on byte:
Set iso-2022-jp state to escape start state and return continue.
Return a code point whose value is byte.
Return finished.
Return error.
If byte is either 0x24 or 0x28, set iso-2022-jp lead to byte, iso-2022-jp state to escape middle state, and return continue.
If byte is not end-of-stream, prepend byte to stream.
Set iso-2022-jp state to ASCII state and return error.
Let lead be iso-2022-jp lead and set iso-2022-jp lead to 0x00.
If lead is 0x24 and byte is either 0x40 or 0x42, unset the iso-2022-jp jis0212 flag, set iso-2022-jp state to lead state, and return continue.
If lead is 0x24 and byte is 0x28, set iso-2022-jp state to escape final state and return continue.
If lead is 0x28 and byte is either 0x42 or 0x4A, set iso-2022-jp state to ASCII state and return continue.
If lead is 0x28 and byte is 0x49, set iso-2022-jp state to Katakana state and return continue.
Let buffer be byte if byte is end-of-stream, and two bytes lead byte otherwise.
Prepend buffer to stream.
Set iso-2022-jp state to ASCII state and return error.
If byte is 0x44, set the iso-2022-jp jis0212 flag, set iso-2022-jp state to lead state, and return continue.
Let buffer be two bytes 0x28 byte, if byte is end-of-stream, and three bytes 0x24 0x28 byte otherwise.
Prepend buffer to stream.
Set iso-2022-jp state to ASCII state and return error.
Based on byte:
Set iso-2022-jp state to ASCII state and return code point U+000A.
Set iso-2022-jp state to escape start state and return continue.
Return finished.
Set iso-2022-jp lead to byte, iso-2022-jp state to trail state, and return continue.
Set the iso-2022-jp state to lead state.
If byte is end-of-stream, return error.
Let code point be null and let pointer be (iso-2022-jp lead − 0x21) × 94 + byte − 0x21.
If iso-2022-jp lead and byte are both in the range 0x21 to 0x7E, set code point to the index code point for pointer in index jis0208, if the iso-2022-jp jis0212 flag is unset, and in index jis0212 otherwise.
If code point is null, return error.
Return a code point whose value is code point.
Based on byte:
Set iso-2022-jp state to escape start state and return continue.
Return a code point whose value is 0xFF61 + byte − 0x21.
Return finished.
Return error.
iso-2022-jp's encoder has an associated iso-2022-jp state.
iso-2022-jp's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F, or is U+00A5 or U+203E, and iso-2022-jp state is not ASCII state, prepend code point to stream, set iso-2022-jp state to ASCII state, and return three bytes 0x1B 0x28 0x42.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
If code point is U+00A5, return byte 0x5C.
If code point is U+203E, return byte 0x7E.
If code point is in the range U+FF61 to U+FF9F and iso-2022-jp state is not Katakana state, prepend code point to stream, set iso-2022-jp state to Katakana state, and return three bytes 0x1B 0x28 0x49.
If code point is in the range U+FF61 to U+FF9F, return a byte whose value is code point − 0xFF61 + 0x21.
Let pointer be the index pointer for code point in index jis0208.
If pointer is null, return error with code point.
If iso-2022-jp state is not lead state, prepend code point to stream, set iso-2022-jp state to lead state, and return three bytes 0x1B 0x24 0x42.
Let lead be pointer / 94 + 0x21.
Let trail be pointer % 94 + 0x21.
Return two bytes whose values are lead and trail.
The index jis0212 is not used by the iso-2022-jp encoder due to lack of widespread support.
shift_jis's decoder has an associated shift_jis lead (initially 0x00).
shift_jis's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream, shift_jis lead is not 0x00, set shift_jis lead to 0x00 and return error.
If byte is end-of-stream and shift_jis lead is 0x00, return finished.
If shift_jis lead is not 0x00, let lead be shift_jis lead, let pointer be null, set shift_jis lead to 0x00, and then run these substeps:
Let offset be 0x40, if byte is less than 0x7F, and 0x41 otherwise.
Let lead offset be 0x81, if lead is less than 0xA0, and 0xC1 otherwise.
If byte is in the range 0x40 to 0x7E or 0x80 to 0xFC, set pointer to (lead − lead offset) × 188 + byte − offset.
Let code point be null, if pointer is null, and the index code point for pointer in index jis0208 otherwise.
If code point is null and pointer is in the range 8836 to 10528, return a code point whose value is 0xE000 + pointer − 8836.
This is interoperable legacy from Windows known as EUDC.
If pointer is null, prepend byte to stream.
If code point is null, return error.
Return a code point whose value is code point.
If byte is in the range 0x00 to 0x80, return a code point whose value is byte.
If byte is in the range 0xA1 to 0xDF, return a code point whose value is 0xFF61 + byte − 0xA1.
If byte is in the range 0x81 to 0x9F or 0xE0 to 0xFC, set shift_jis lead to byte and return continue.
Return error.
shift_jis's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+0080, return a byte whose value is code point.
If code point is U+00A5, return byte 0x5C.
If code point is U+203E, return byte 0x7E.
If code point is in the range U+FF61 to U+FF9F, return a byte whose value is code point − 0xFF61 + 0xA1.
Let pointer be the index shift_jis pointer for code point.
If pointer is null, return error with code point.
Let lead be pointer / 188.
Let lead offset be 0x81, if lead is less than 0x1F, and 0xC1 otherwise.
Let trail be pointer % 188.
Let offset be 0x40, if trail is less than 0x3F, and 0x41 otherwise.
Return two bytes whose values are lead + lead offset and trail + offset.
euc-kr's decoder has an associated euc-kr lead (initially 0x00).
euc-kr's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream and euc-kr lead is not 0x00, set euc-kr lead to 0x00 and return error.
If byte is end-of-stream and euc-kr lead is 0x00, return finished.
If euc-kr lead is not 0x00, let lead be euc-kr lead, let pointer be null, set euc-kr lead to 0x00, and then run these substeps:
If lead is in the range 0x81 to 0xC6, let temp be (26 + 26 + 126) × (lead − 0x81), and then set pointer to the result of the equation below, depending on byte:
temp + byte − 0x41
temp + 26 + byte − 0x61
temp + 26 + 26 + byte − 0x81
If lead is in the range 0xC7 to 0xFE and byte is in the range 0xA1 to 0xFE, set pointer to (26 + 26 + 126) × (0xC7 − 0x81) + (lead − 0xC7) × 94 + (byte − 0xA1).
Let code point be null, if pointer is null, and the index code point for pointer in index euc-kr otherwise.
If pointer is null, prepend byte to stream.
If code point is null, return error.
Return a code point whose value is code point.
If byte is in the range 0x00 to 0x7F, return a code point whose value is byte.
If byte is in the range 0x81 to 0xFE, set euc-kr lead to byte and return continue.
Return error.
euc-kr's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
Let pointer be the index pointer for code point in index euc-kr.
If pointer is null, return error with code point.
If pointer is less than (26 + 26 + 126) × (0xC7 − 0x81), run these substeps:
Let lead be pointer / (26 + 26 + 126) + 0x81.
Let trail be pointer % (26 + 26 + 126).
Let offset be 0x41 if trail is less than 26, 0x47 if trail is less than 26 + 26, and 0x4D otherwise.
Return two bytes whose values are lead and trail + offset.
Set pointer to pointer − (26 + 26 + 126) × (0xC7 − 0x81).
Let lead be pointer / 94 + 0xC7.
Let trail be pointer % 94 + 0xA1.
Return two bytes whose values are lead and trail.
The replacement encoding exists to prevent certain attacks that abuse a mismatch between encodings supported on the server and the client.
replacement's decoder has an associated replacement error returned flag (initially unset).
replacement's decoder's handler, given a stream and byte, runs these steps:
If replacement error returned flag is unset, set the replacement error returned flag and return error.
Return finished.
replacement's encoder is utf-8's encoder.
To convert a code unit to bytes using a utf-16be flag, run these steps:
Let byte1 be code unit >> 8.
Let byte2 be code unit & 0x00FF.
Then return the bytes in order:
byte1, then byte2.
byte2, then byte1.
A byte order mark has priority over a label as it has been found to be more accurate in deployed content. Therefore it is not part of the shared utf-16 decoder algorithm but rather the decode algorithm.
shared utf-16 decoder has an associated utf-16 lead byte and utf-16 lead surrogate (both initially null), and utf-16be flag (no initial value).
shared utf-16 decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream and either utf-16 lead byte or utf-16 lead surrogate is not null, set utf-16 lead byte and utf-16 lead surrogate to null, and return error.
If byte is end-of-stream and utf-16 lead byte and utf-16 lead surrogate are null, return finished.
If utf-16 lead byte is null, set utf-16 lead byte to byte and return continue.
Let code unit be the result of:
(utf-16 lead byte << 8) + byte.
(byte << 8) + utf-16 lead byte.
Then set utf-16 lead byte to null.
If utf-16 lead surrogate is not null, let lead surrogate be utf-16 lead surrogate, set utf-16 lead surrogate to null, and then run these substeps:
If code unit is in the range U+DC00 to U+DFFF, return a code point whose value is 0x10000 + ((lead surrogate − 0xD800) << 10) + (code unit − 0xDC00).
Prepend the sequence resulting of converting code unit to bytes using utf-16be flag to stream and return error.
If code unit is in the range U+D800 to U+DBFF, set utf-16 lead surrogate to code unit and return continue.
If code unit is in the range U+DC00 to U+DFFF, return error.
Return code point code unit.
shared utf-16 encoder has an associated utf-16be flag.
shared utf-16 encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range 0x00 to 0xFFFF, return the sequence resulting of converting code point to bytes using utf-16be flag.
Let lead be ((code point − 0x10000) >> 10) + 0xD800, converted to bytes using utf-16be flag.
Let trail be ((code point − 0x10000) & 0x3FF) + 0xDC00, converted to bytes using utf-16be flag.
Return a byte sequence of lead followed by trail.
utf-16be's decoder is shared utf-16 decoder with its utf-16be flag set.
utf-16be's encoder is shared utf-16 encoder with its utf-16be flag set.
Both "utf-16
" and
"utf-16le
" are labels for
utf-16le to deal with deployed content.
utf-16le's decoder is shared utf-16 decoder with its utf-16be flag unset.
utf-16le's encoder is shared utf-16 encoder with its utf-16be flag unset.
While technically this is a single-byte encoding, it is defined separately as it can be implemented algorithmically.
x-user-defined's decoder's handler, given a stream and byte, runs these steps:
If byte is end-of-stream, return finished.
If byte is in the range 0x00 to 0x7F, return a code point whose value is byte.
Return a code point whose value is 0xF780 + byte − 0x80.
x-user-defined's encoder's handler, given a stream and code point, runs these steps:
If code point is end-of-stream, return finished.
If code point is in the range U+0000 to U+007F, return a byte whose value is code point.
If code point is in the range U+F780 to U+F7FF, return a byte whose value is code point − 0xF780 + 0x80.
Return error with code point.
There have been a lot of people that have helped make encodings more interoperable over the years and thereby furthered the goals of this standard. Likewise many people have helped making this standard what it is today.
Ideally they are all listed here so please contact the editor with any omissions.
With that, many thanks to Alan Chaney, Alexander Shtuchkin, Allen Wirfs-Brock, Asmus Freytag, Ben Noordhuis, Boris Zbarsky, Cameron McCormack, Charles McCathieNeville, David Carlisle, Dominique Hazaël-Massieux, Doug Ewell, Erik van der Poel, 譚永鋒 (Frank Yung-Fong Tang), Geoffrey Sneddon, Glenn Maynard, Gordon P. Hemsley, Henri Sivonen, Ian Hickson, James Graham, John Tamplin, Joshua Bell, 신정식 (Jungshik Shin), 강 성훈 (Kang Seonghoon), 川幡太一 (Kawabata Taichi), Ken Lunde, Ken Whistler, Kenneth Russell, Leif Halvard Silli, Makoto Kato, Mark Callow, Mark Davis, Martin Dürst, Masatoshi Kimura, Ms2ger, Nigel Tao, Norbert Lindenberg, Øistein E. Andersen, Peter Krefting, Philip Jägenstedt, Philip Taylor, Richard Ishida, Robbert Broersma, Robert Mustacchi, Ryan Dahl, Shawn Steele, Simon Montagu, Simon Pieters, Simon Sapin, Vyacheslav Matva, and 成瀬ゆい (Yui Naruse) for being awesome.


Show Types
Show Controllers
Show Services
Show Interfaces
Show Directives
Show unknowns
Hierarchical display ?


{{ var pageTitle = 'nodEdu'; var ejsUp = 'This message was placed here by ejs'; }} {{include inc.start.html}} {{include inc.header.html}}


The fax4j is a Java fax library.
This library enables Java applications to invoke fax actions such as submitting fax jobs.
You can get the latest version from here
The fax4j provides a standard and consistent faxing API to enable invoking the different fax actions from Java applications.
The fax4j library enables to integrate with fax services via many different SPI (service provider interface) implementations.
Currently fax4j supports the following implementations:
Windows native fax API (requires windows fax/tapi component installed)
Windows COM fax API (via VBS called from the Java layer, requires windows fax/tapi component installed)
Email (via email servers that enable to send fax message based on incoming email messages) including built-in support for many of the leading vendors.
HTTP
External Processes
Linux native fax API (requires linux efax utility)
Mac native fax API
HylaFax (via gnu-hylafax library)
And more...
In addition the fax4j library also provides the fax bridge API which is a context specific faxing API.
The fax bridge enables to transform emails servers, web servers and more into an online fax service.
The x2fax sub project provides a set of standalone servers and deployable components which enable to provide x2fax services out of the box.
The x2fax contains built-in email component to enhance email servers to provide email2fax services and HTTP servers and WARs to convert any Java web server into a web2fax bridge.
//get new instance of a fax client (based on internal + external fax4j.properties file data) FaxClient faxClient=FaxClientFactory.createFaxClient(); //create a new fax job FaxJob faxJob=faxClient.createFaxJob(); //set fax job values faxJob.setFile(new File("./my_document.txt")); faxJob.setPriority(FaxJobPriority.HIGH_PRIORITY); faxJob.setTargetAddress("555-555"); faxJob.setTargetName("YourName"); faxJob.setSenderEmail("myemail@mycompany.com"); faxJob.setSenderName("MyName"); //submit fax job faxClient.submitFaxJob(faxJob); //print submitted fax job ID (may not be supported by all SPIs) System.out.println("Fax job submitted, ID: "+faxJob.getID());
Please checkout the forums for any questions, comments, bugs, suggestions and so on.
User testimonials are always welcome.
You can also go to the tutorial at: javadoc
The fax4j library comes with a maven pom.xml which can be used to build the Java layer of the library.
On windows, the fax4j.dll will also be built, therefore the path for the msbuild.exe (in the .NET installation) must be set.
While this library supports java 1.5 and up, the build process of this library (not of depended libraries) require java 5/6.
However building this library from source is not required as it provide many extension capabilities via configuration.
Each SPI has it's requirements.
See the SPI javadoc for more information (each SPI javadoc contains the information relevant for it specifically).
You can also go to the tutorial at: javadoc
Each SPI has it's installation/setup requirements.
See the SPI javadoc for more information (each SPI javadoc contains the information relevant for it specifically).
You can also go to the tutorial at: javadoc
Currently this library is in maintenance mode and no future development is currently being planned.
The fax4j library is distributed under the "The Apache Software License, Version 2.0" license which means that it is possible to distribute this library also in commercial closed source products.
See license report for more info.
See Change Log for full report.


Shop
Pharmacy
Checkout
(current)
Your cart
3
Hand Soap
$2.49
Multi-Purpose Cleaner
$3.48
Toilet Paper
$4.80
Total (USD)
$10.77
Proceed to Checkout
Shipping Address
First Name
This field is required.
Last Name
This field is required.
Complete field to go to the next step.
Address
This field is required.
City
This field is required.
State
California
This field is required.
Zip
This field is required.
Complete all fields to continue.
Billing Address
First Name
This field is required.
Last Name
This field is required.
Address
This field is required.
City
This field is required.
State
California
This field is required.
Zip
This field is required.
Shipping address is the same as my billing address
Complete all fields to continue.
Credit Card
Name
Name as it appears on your credit card.
This field is required.
Credit Card Number
This field is required.
Month
1
2
3
4
5
6
7
8
9
10
11
12
This field is required.
Year
2021
2022
2023
2024
2025
This field is required.
CVV
This field is required.
Checkout


@* * Copyright 2023 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @(params: Map[String, Any]) @title = @{"You have a new letter online"} @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, title, false) {
We have just published your new income tax calculation letter to your secure online personal tax account.
Details in the letter will tell you how to pay HMRC or claim back any funds we may owe you.
If you are due a refund, claiming online will mean you can have funds transferred directly to you within 5 working days.
To keep your personal information safe, we do not put a link to your online account in our emails to you.
Please log in now to HMRC online and go to your messages to read your full income tax calculation letter. Do this using your Government Gateway password and ID.
From HMRC PAYE
}


Hi! My name is Liuzhijun, and I work as a Software Engineer at Guangzhou China, Most of the time I write Python code. I also use Java write something, such as Android App. You can contact me via<EMAIL_ADDRESS>Hi! My name is Liuzhijun, and I work as a Software Engineer at Guangzhou China, Most of the time I write Python code. I also use Java write something, such as Android App. You can contact me via lzjun567@gmail.com


--- layout: post title: By the power of LazyWeb... Asynchronous Instant Messaging date: 2004-06-08 00:00:00 ---
Is anyone aware of an IM client which is explicitly asychronous in the way that SMS is? i.e. one where instead of messages demanding instant replies, they "pile up" and await your attention. I'd be interested to see how this changed messaging behaviour - personally I think I'd find it more polite than an application which seems explicitly designed to interrupt me when I'm working.
(which is not to say I can't see the value of IM, or don't use it)
I think this would be purely a question of a new interface (rather than new protocols): don't pop up a window when a message comes in, just beep and invite me to check it out when I have time. I guess this is a bit like "email with presence" or err "fixed line SMS" (
Update: hmm, actually there seem to be some settings in MSN Messenger which stop the automatic popping up of Windows; I can't check right now (on the train up to Leeds) but maybe I can munge Messenger into approximating what I'm after...


SexpProcessor
| home : | github.com/seattlerb/sexp_processor |
| rdoc : | parsetree.rubyforge.org/sexp_processor |
DESCRIPTION:
sexp_processor branches from ParseTree bringing all the generic sexp processing tools with it. Sexp, SexpProcessor, Environment, etc... all for your language processing pleasure.
FEATURES/PROBLEMS:
- Includes SexpProcessor and CompositeSexpProcessor.
- Allows you to write very clean filters.
SYNOPSIS:
class MyProcessor < SexpProcessor def initialize super self.strict = false end def process_lit(exp) val = exp.shift return val end end
REQUIREMENTS:
- rubygems
INSTALL:
- sudo gem install sexp_processor
LICENSE:
(The MIT License)
Copyright © Ryan Davis, seattle.rb
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Can we predict crime rates in a borough through demographic data?
Read data sources
Merge demographic data with crime rates
Visual data exploration
Write data to feather file
Initialize h2o environment
Read feather file
Make subset of Nijmegen
Make subset of Netherlands w/o Nijmegen
Fit linear model on training data
Predict on test data


Pakistan draws Indian ire with museum display on captured pilot Abhinandan
by ReutersKARACHI: The crude waxwork figure isn’t much to look at, although it does feature the famous moustache.
But Pakistan’s new museum exhibit on an Indian pilot captured when the two nations came close to war earlier this year is causing ire across the border.
Pakistan Air Force on Wednesday opened a new gallery in its museum on Wing Commander Abhinandan Varthaman, who was shot down in a dog-fight in February.
Abhinandan became the face of the crisis after Islamabad released a video of him drinking tea with Pakistani officers while in captivity.
He politely refused to answer questions in the video, but proclaimed the tea offered to him “fantastic”.
That tea cup, along with the pilot’s flight uniform and other items from the skirmish, are now displayed in the museum in Karachi.
A large effigy of the pilot, dressed in a copy of his Indian uniform, is also on show. During the crisis Indians rushed to barber shops to emulate Abhinandan’s trademark handlebar moustache, while the capture of the pilot become a symbol of pride for Pakistan.
“When Abhinandan tried to attack he was arrested and within two days he was returned as a goodwill gesture to give a message of peace,” said Hamna Shaikh, a college student visiting the exhibit.
“All his belongings are now here on display, it felt very good today seeing all these articles.”
The new exhibit is less popular in India, however, with footage of the display going viral on social media and sparking heated arguments online between Indians and Pakistanis about past wars.
Times Now, one of India’s most-popular TV networks, called the gallery “bizarre propaganda”.
Abhinandan, who was injured in the crash, returned to flying in September.
Officials from the Pakistan Air Force attending the opening of the gallery declined to comment on the exhibit. A spokesperson for the Indian Air Force did not respond to a request for comment.


Makes: 100 servings
Prep Time: 2 hrs
Cook Time: 1h 15min
- 24 L water
- 100 potatoes washed, cubed
- ¼ cup sea salt (optional)
- 2 cups olive oil (optional)
- 4 heads garlic, dices
- 15 onions, chopped
- 4 cups nutritional yeast
- 2 cups tamari or soy sauce
- 1 cup cumin
- 40 L pot
- very large skillet
Over high heat, sauté about 3 tbsp of diced garlic for 30 seconds in oiled or dry skillet. Add about 2 cups of onions and sauté until clear, about 3-5 minutes, stirring often. Then add enough potatoes to fill the skillet and fry until they start to brown. Keep stirring, and scrape the bottom of the skillet occasionally. Sprinkle in some of the yeast, cumin and tamari or soy sauce while stirring. (Hint: mix tamari or soy sauce with equal parts water for more even distribution when sprinkling.) Mix well and empty skillet into a large metal serving bowl. Place in a 150 degree oven to keep warm. Repeat the process until all the potatoes are cooked or everyone is fed. Serve homefires hot with dry roasted sunflower and sesame seeds and/or ketchup. You can cook the potatoes without oil.


_Eyes_Wide_Shut_ (R) **** (out of ****)
The late Stanley Kubrick's long-awaited final film, _Eyes_Wide_Shut_, is the perfect example of a true NC-17 film--but not in the way one would be led to believe.  Fanning the flames of speculation was the now-familiar scene of a nude Cruise and Kidman making love in front of a mirror, the first taste of the film made available to the public.
Having seen the actual film, I advise anyone ready to don their raincoats for a showing of _Eyes_Wide_Shut_ to think twice. Yes, there is some strong sexual content (some of which was altered to receive an R rating, but more on that later), but not the wall-to-wall fornication as had been whispered. Rather than _being_ sex, _Eyes_Wide_Shut_ is _about_ sex--a film that explores this adult theme in a sensitive, mature, and thoughtful manner. If that isn't a film that could not better exemplify a rating that simply means, in its literal definition, "No one 17 and under admitted," then I don't know what is.
Kubrick isn't above a little playful teasing, and that's what he does for the opening section of _Eyes_Wide_Shut_, which appears to suggest all manner of ensuing tawdriness. The opening shot is of Kidman's character, former art gallery manager (_not_ psychiatrist nor medical doctor) Alice Harford, doffing her duds and baring nearly all. Once fully dressed, she and her husband, Dr. Bill Harford (Cruise) make their way to a swank party thrown by wealthy friend Victor Ziegler (Sydney Pollack, in a role once meant for Harvey Keitel). At the soirée, a tipsy Alice engages in a dangerous flirtation with an anonymous partygoer while eyeing her husband getting friendly with a pair of seductive models.
Not too long after that, a fully nude female form appears onscreen, but not in the way one would expect. Similarly unexpected is the turn that soon comes in one astonishing Cruise-Kidman bedroom scene, which reveals itself to be the film's driving dramatic force. While this scene is all about sex, it is not _of_ sex; in fact, it is of words describing sex, and in decidedly inexplicit terms. What lends this scene such power, however, is the hypnotic effect that comes when all facets of cinema are triumphantly married: photography, editing, writing, and especially directing and acting. A description of what the scene literally entails would sound deceptively simple and thus completely fail to do it justice. Directed with remarkable precision and control by Kubrick and quite simply the most triumphant moment in Kidman's entire acting career, this scene is the first of _Eyes_Wide_Shut_'s fair share of haunting moments.
This charged encounter sends Bill off into the streets and the film into its main (for lack of a better term) action, where in one, long night, he is simultaneously repulsed and enticed by various sex-related situations he happens to stumble upon. The decadent centerpiece of his journey (and of the film itself) is a now-notorious orgy sequence, made even more controversial by the addition of some obvious digital effects work used to obscure some sex acts--and hence secure an R rating. From what I understand, no genitalia nor glimpses of penetration could be seen in Kubrick's unobstructed view, which is just as well--the point of the scene is not to titillate but to create an unsettling atmosphere where desire and carnal curiosity becomes tinged with danger and outright fear. (The atmosphere is stunningly bolstered by Jocelyn Pook's chilling minimalist score.) The point still comes across in the censored version, but undoubtedly diluted, for the unconvincing CGI work just serves to distract more than anything else.
This bit of censorship (which Warner Bros. insists was approved by Kubrick before his sudden death in March) also shows just how out-of-touch the Motion Picture Association of America's ratings board is. It fails to realize that it's not the presence of sex that matters but its context and intended effect. For all the scandalous associations that come with an orgy, there is nothing exploitative about the sequence; it is far more disturbing than it is the slightest bit arousing (which it isn't), and the sex is a means to a cinematic end and not the end itself.
Kubrick, his co-scripter Frederic Raphael (working from the "inspiration" of Arthur Schnitzler's novel _Traumnovelle_), Cruise, and Kidman's end is to create a probing and painfully real examination of a marriage, relationships in general, and basic human desire and nature. Clocking in at well north of the two-and-a-half-hour mark, there is bound to be a slow stretch here and there, and one late plot revelation is a bit too easily predictable; but overall, there is nary a false note in the execution. Though receiving equal star billing and delivering an outstanding and revealing (in every way) performance, Kidman's presence definitely takes a backseat to that of her on- and off-screen husband, who dominates the screen time. Cruise's innate likability and average-guy appeal makes him the ideal audience surrogate for this foray into the sexual underground; one can completely relate to his fascination and fear of all that he witnesses. The secondary roles are also well-cast, from Pollack (who, in the end, is probably a more effective choice for his role than Keitel could have been) and Sobieski (as a fetching nymphet) to a hilarious Alan Cumming as a hotel desk clerk who makes no secret of his interest in Bill. The one strained performance comes from Marie Richardson, who bears a passing resemblance to her role's original portrayer, Jennifer Jason Leigh (who was replaced when she was unavailable for reshoots); though stiff and awkward in her single scene with Cruise, her work is far from ruinous to the film.
It would take something much larger than that to detract from the vision of Kubrick, to whose control the audience completely surrenders. The common reaction once the end credits began to run was a simple "hmm," and while it doesn't sound that way, that is a good thing. _Eyes_Wide_Shut_ is thought-provoking, but the film's spell goes beyond that; it makes you _want_ to think about it afterward. That feeling even permeated this week's gala premiere of the film; in post-screening interviews, many of the celebrities in attendence expressed their need to think about what they had just seen.
That, right there, makes me somewhat grudgingly grateful that the film didn't end up hitting screens with the dreaded NC-17 rating. _Eyes_Wide_Shut_ is a rich, challenging work, and as such, it is certain to fly clear over the heads of a baffled American moviegoing public; consequently, the film is all but certain to die a quick--and much-talked-about--box office death. And in this entertainment/political climate of scapegoating, had the film been released with an NC-17, fingers would have been pointed at the rating, rendering it even more useless than it already is. If one of the biggest, if not the biggest, movie star in the world is unable to make an NC-17 film commercially viable (regardless of its subject matter, challenging or otherwise), then no one would ever want to touch the NC-17 ever again. There is no excusing Warner Bros.'s tampering with Kubrick's work, but at least it leaves the door open for another name star, another high-profile director, and a major studio bold enough to take risks meant to be seen exclusively by an adult audience. However, the sad case remains that it is sure to be a very long while before anyone dares to think of entering that doorway again.
Michael Dequina<EMAIL_ADDRESS>|<EMAIL_ADDRESS>|<EMAIL_ADDRESS>|<EMAIL_ADDRESS>Mr. Brown's Movie Site: http://welcome.to/mrbrown CompuServe Hollywood Hotline: http://www.HollywoodHotline.com on ICQ: #25289934 | on AOL Instant Messenger: MrBrown23
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


the little static site engine that could
Getting started with Booklit assumes basic knowledge of the Go programming language. Be sure to have it installed!
The best way to get started with Booklit is to create a Go module with Booklit as a dependency:
# create go.mod and go.sum
go mod init example
# add booklit to go.mod and install CLI
go get github.com/vito/booklit/cmd/booklit
It's also possible to download the booklit
executable from the latest GitHub release, but tracking it as a dependency will make it easier to write a plugin later on.
First, create a file called hello.lit
with the following content:
\title{Hello, world!}{hello}
I'm a Booklit document!
This file can exist anywhere, but one common convention is to place .lit
documents under lit/
, HTML templates under html/
, and plugin code under go/
.
Run the following to build and render the file to ./docs/hello.html
:
$ booklit -i hello.lit -o docs
Each of the changes in the following sections will require re-building, which can be done by running the above command again. Alternatively, you can run booklit
with the -s
flag to start a HTTP server:
$ booklit -i hello.lit -s 8000
INFO[0000] listening port=8000
Once Booklit says 'listening', browse to http://localhost:8000/hello.html. When you change anything, just refresh and your content will be rebuilt and re-rendered.
Next, let's try adding a section within our document:
After building, you should see something like this:
Hello, world!
I'm a Booklit document!
1 Hi there!
I'm so organized!
That number "1" might look a bit weird at the moment, but it's the section number, and it'll be something like "3.2" for a nested section. You can always remove it by specifying your own template (more on that later), but for now let's leave it there.
To render each sub-section on its own page, simply call \split-sections
somewhere in the section.
\title{Hello, world!}{hello}
\split-sections
I'm a Booklit document!
\section{
\title{Hi there!}
I'm so organized!
}
So far we've just made the section disappear, which isn't very helpful. Let's at least make it so we can browse to it! This can be done with \table-of-contents
:
\title{Hello, world!}{hello}
\split-sections
I'm a Booklit document!
\table-of-contents
\section{
\title{Hi there!}
I'm so organized!
}
Note that when viewing the sub-section, its header is now a

rather than the

it was before, since it stands on its own page.
Having a \table-of-contents
is great and all, but more often you'll want to reference sections from each other directly and in context. This can be done with \reference
:
\title{Hello, world!}{hello}
\split-sections
I'm a Booklit document! To read further, see \reference{hi-there}.
\section{
\title{Hi there!}
I'm so organized!
}
The first argument to \reference
is the name of a tag to link. At build time, references will resolve to their tag and generate a link to it. By default, the name of the link is determined by the tag, so for a section it'll be the section's title. This can be overridden by passing a second argument to \reference
:
\title{Hello, world!}{hello}
\split-sections
I'm a Booklit document! Consult \reference{hi-there}{this section} for
more.
\section{
\title{Hi there!}
I'm so organized!
}
What we've gone over should carry you pretty far. But you'll likely want to know a lot more.
To change how your generated content looks, check out the HTML renderer.
To learn the \functions
that come with Booklit, check out Basic Functions.
To extend your documents with your own \functions
, check out Plugins.


Start Bootstrap
Dashboard
Shortcuts
Overview
Events
About
Services
Contact
Profile
Username:
Email:
Password:
Name:
Age:
Location:
Save


Level 2 Information Gathering
(think: Best Practice) This level can be created using automated tools from level 1 and some manual analysis. A good understanding of the business, including information such as physical location, business relationships, org chart, etc.
Widgets Inc is required to be in compliance with PCI, but is interested in their long term security strategy, and is acquiring several smaller widget manufacturers.


|
Table 1
|
The energies of all intermolecular interactions in the cryst ... |
|
Table 2
|
The temperature (A) and pressure-induced strains: based on e ... |
|
Table 3
|
Variation of the cohesive energy and the energy of the π ⋯ π ... |
|
Table 4
|
Experimental details. The triclinic setting ( α and γ cell a ... |


I'm always passionate about solving other people's problems - Jeffery Owen
German Based Nigerian football star and music enterprenuer, Jeffery Owen has revealed some of the things that drives and motivates him into building a sustainable legacy and helping others get over their challenges.
“I am driven and motivate by love and passion, driven by society. There is this desire to solve problems, improve lives of people and build a legacy that can be passed down” He said.
The 26 years old who is also carving a niche for himself in the round leather game, shed more light on the Nigerian side of him, despite playing football in Germany, “Yeah I am a footballer, playing in Germany but don’t be deceived, I am 100% Nigerian. I was born in Edo State and grew up there. Benin-City to be precise,” he said.
Also known as Nino with good look. When asked how he handles his female fans, he didn’t waste time in revealing the secret, “I would not say I am a ladies’ man, but I’m quite well with my female supporters” He said.
On marriage status; “I am not married, I’m single but I have a girlfriend and two lovely boys.”
Describing his dream woman and giving his own definition of true love, the Edo State born said’ “My dream woman is my current girlfriend, she has all the characteristics I am looking for in a woman, and my own definition of true love is deep but let me say an intense feeling of deep affection, showing great interest and care to someone or something.” he explained.
“My best form of exercise apart from my usual training as a footballer is swimming, it helps ease the tension. If I am not swimming, I am writing down stuff in my journal to read later, this helps me relax and focus”. On what he does when he is not playing football, and not busy with activities in entertainment, “If I am not playing football or busy with work, I am spending time with my family. I am simple fashion guy. I like street style, mixed a sprinkle of classy or black tie style.
Jeffery who played in Holland for AFC Arnhem, before moving to Germany is also a partner of House of Gold Entertainment. He has worked with top Nigerian music stars, such as 2baba, Timaya, Phyno, Flavour and Lil Kesh, as an event promoter. He recently set up a record label, Lexa Records, and signed Mawthie as his debut artiste.


|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jelly.apt.strategies.TemplateStrategyControl<B> net.sf.jelly.apt.strategies.TemplateBlockStrategy<B> net.sf.jelly.apt.strategies.TemplateOutputRedirectionStrategy<B> net.sf.jelly.apt.strategies.FileStrategy org.codehaus.enunciate.template.strategies.EnunciateFileStrategy
public class EnunciateFileStrategy
A file strategy that takes into account a base directory.
| Constructor Summary | |
|---|---|
EnunciateFileStrategy(java.io.File outputDirectory)
|
| Method Summary | |
|---|---|
java.io.PrintWriter |
getWriter()
|
| Methods inherited from class net.sf.jelly.apt.strategies.FileStrategy |
|---|
getAnnotationProcessorEnvironment, getCharset, getName, getPackage, setCharset, setName, setPackage |
| Methods inherited from class net.sf.jelly.apt.strategies.TemplateOutputRedirectionStrategy |
|---|
postProcess, preProcess |
| Methods inherited from class net.sf.jelly.apt.strategies.TemplateBlockStrategy |
|---|
processBody |
| Methods inherited from class net.sf.jelly.apt.strategies.TemplateStrategyControl |
|---|
invoke |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EnunciateFileStrategy(java.io.File outputDirectory)
| Method Detail |
|---|
public java.io.PrintWriter getWriter() throws java.io.IOException, net.sf.jelly.apt.strategies.MissingParameterException
getWriter
in class net.sf.jelly.apt.strategies.FileStrategy
java.io.IOException
net.sf.jelly.apt.strategies.MissingParameterException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


{% extends 'base.html' %} {% block content %}
Changing lives and strengthening communities through reclassification.
find court houses & live scan center...
See what you need & submit documents
Send your documents


Sign in and save JWT response, with Database, and user audit history
You have been logged out.
User Name :
Password:


Input a Spotify Playlist Link to get a plaintext version of the playlist!
To get the Spotify Playlist Link, right-click the playlist's name, and click on Copy Playlist Link


Guidance
Information for primary schools about the reception baseline assessment for 2016 to 2017.
Following publication of a study to compare the 3 different reception baseline assessments used in the 2015 to 2016 academic year , we will not use them as the starting point for measuring progress.
Instead, when this year’s reception classes leave primary school in 2022, we will continue to use key stage 1 as the starting point from which to measure pupils’ progress to key stage 2.
Schools can opt to use baseline assessments as on-entry assessments in the 2016 to 2017 academic year.
The approved providers for the reception baseline assessment for the 2016 to 2017 academic year are:
We will not use the outcomes from the assessments for accountability.
DfE has not set a deadline for signing up to an approved baseline assessment, although suppliers may decide to set their own dates.
DfE will cover the basic cost of approved baselines for local-authority-maintained schools, academies and free schools. Please check the details of what each supplier is offering, once available, so you are aware of any additional costs over and above the basic price.
For local-authority-maintained schools, reimbursements will be made via the relevant local authority. For academies and free schools, DfE will reimburse them directly for the basic cost
Independent schools who decide to use the reception baseline won’t get any government funding for it. They’ll have to pay for the baseline from their own budget.
Published: 4 February 2015
Updated: 14 April 2016


X = Matrices.discreteRiccati(A, B, R, Q); (X, alphaReal, alphaImag) = Matrices.discreteRiccati(A, B, R, Q, true);
Function discreteRiccati computes the solution X of the discrete-time algebraic Riccati equation
A'*X*A - X - A'*X*B*inv(R + B'*X*B)*B'*X*A + Q = 0
using the Schur vector approach proposed by Laub [1].
It is assumed that Q is symmetric and positive semidefinite and R is symmetric, nonsingular and positive definite, (A,B) is stabilizable and (A,Q) is detectable. Using this method, A has also to be invertible.
These assumptions are not checked in this function !!!
The assumptions guarantee that the Hamiltonian matrix.
H = [A + G*T*Q, -G*T; -T*Q, T]
with
-T T = A
and
-1 G = B*R *B'
has no eigenvalue on the unit circle and can be put to an ordered real Schur form
U'*H*U = S = [S11, S12; 0, S22]
with orthogonal similarity transformation U. S is ordered in such a way, that S11 contains the n stable eigenvalues of the closed loop system with system matrix
-1 A - B*(R + B'*X*B) *B'*X*A
If U is partitioned to
U = [U11, U12; U21, U22]
according to S, the solution X can be calculated by
X*U11 = U21.
[1] Laub, A.J. A Schur Method for Solving Algebraic Riccati equations. IEEE Trans. Auto. Contr., AC-24, pp. 913-921, 1979.
A = [4.0 3.0] -4.5, -3.5]; B = [ 1.0; -1.0]; R = [1.0]; Q = [9.0, 6.0; 6.0, 4.0] X = discreteRiccati(A, B, R, Q); results in: X = [14.5623, 9.7082; 9.7082, 6.4721];
function discreteRiccati extends Modelica.Icons.Function; import Modelica.Math.Matrices; input Real A[:, size(A, 1)] "Square matrix A in DARE"; input Real B[size(A, 1), :] "Matrix B in DARE"; input Real R[size(B, 2), size(B, 2)] = identity(size(B, 2)) "Matrix R in DARE"; input Real Q[size(A, 1), size(A, 1)] = identity(size(A, 1)) "Matrix Q in DARE"; input Boolean refine = false "True for subsequent refinement"; output Real X[size(A, 1), size(A, 2)] "orthogonal matrix of the Schur vectors associated to ordered rsf"; output Real alphaReal[2 * size(A, 1)] "Real part of eigenvalue=alphaReal+i*alphaImag"; output Real alphaImag[2 * size(A, 1)] "Imaginary part of eigenvalue=alphaReal+i*alphaImag"; end discreteRiccati;


Tree Models
Nested Set Model
Adjacency model
Loading
Load Rows On Demand (AJAX)
Load All Rows At Once Collapsed
Load All Rows At Once Expanded
Look and Feel
Expand a node by click the name
Fixed height
Icon can be changed
Icon from data field
Functionalities
Navigation with keyboard
Action on selecting node
Simulate simple tree
Add/Update/Delete Nodes
Add Node
Delete Node
Add, Edit, Delete Nodes


{% extends "layout.html" %} {% block content %}
Access to service one do this and that. and more
Access to service two do this and that. and more
| Status | Expiry Date/Duration | Name | Description and Parameter |
|---|---|---|---|
| Pending | 1 Month | service-three | Access service three |
| Status | Expiry Date | Name | Description and Parameter |
|---|---|---|---|
| Granted | 2014-12-31 | service-one | Access service one at unlimited volume; Max access per day 500 |
| Revoked | 2014-11-30 | service-two | Access service two |
| Expired | 2014-05-20 | service-three | Read Access service three |
| Timestamp | Entitlement | Action | Result |
|---|---|---|---|
| 2014-08-20 14:42:15 | service-one | API query | Valid |
| 2014-08-20 14:41:53 | service-one | API query | Valid |
| 2014-08-20 13:10:23 | service-two | API query | Invalid |
| 2014-08-19 13:10:23 | service-two | Revoke | Not applicable |
| 2014-08-17 13:10:23 | service-two | API query | Valid |


{{login_error}}
Only demo account available (sign up is not allowed for demo): login: demouser password: 111


The best deals from around the world to get you around the world
Here is some more information about this product that is only revealed once clicked on.


olfactory SARS-CoV- ACE {border-style expression px;} #ffffff;} human virus TMPRSS cells brain epithelium nasal neurons immune infection non-neuronal early cavity data COVID- ORNs px; studies {font-family font-size respiratory viral Figure However, cell detection double; express likely located mouse patients receptor Olfactory SARS-CoV Table axonal biological border-color border-width brain. cells. high host infected known mice murine neuronal present shown solid; symptoms types {font-style {font-weight ACS GEO RNaseq asymptomatic binding bold clearly compared considered courier; different em; entry epithelial hACE infection. low people possibility pt;} required response responses suggest time transgenic transport virus.


Ooops!
RikiTraki cannot find what you are looking for (404).
I cannot find the document you are requesting...


Note for Prospective Students
I am looking for highly motivated students who want to work in the field of machine learning, deep learning, computer vision, and multimedia analytics. Particularly, my current reserach is focus on privacy in AI, Vision + NLP problems, and healthcare data analytics.
Expectation from the prospective student:- Sound knowledge of Machine Learning (ML). You are required to complete all the 5 courses in Coursera's Deep Learning Specialization (auditing without certification is free.)
- You may refer Deep learning books: Deep Learning Book, Dive into Deep Learning
- Good programming skills [preferably in Python+Pytorch]
- Strong paper writing skills and willing to write a research paper with me.
- A commitment to work with me at least for 1 year on a research problem.
What you will be working on? My current research is mainly focused on privacy and security in AI. I am particularly interested in identifying the vulnerabilities in existing machine learning/deep learning systems. I am also inquisitive about the data privacy regulations and their impact on ML/DL based companies. Apart from that I am working on challenging computer vision and human computer-interaction problems. The application of my work include surveillance, data privacy, cyber security, healthcare, entertainment, and climate change.
The following are some of the main topics of my current research:- Privacy and Security in AI
- Data Privacy in Machine Learning
- Data Valuation
- Robustness in Deep Learning
- Multimedia Privacy and Security
- Machine Learning, Computer Vision, Deep Learning
I am always open to work on new ideas and problems with real world applications.
If you are interested, drop me an email at murari.nus@gmail.com


Pattern Matching: Introduction
Say you're working in a recycling facility and want to write a program that will sort the aluminum, paper, and plastic recyclables. This would be easy enough to write using if statements:
def sortItems(recyclable):
"""sort the items based on material"""
if recyclable is aluminum:
"""execute code to put recyclable into the aluminum bin"""
elif recyclable is paper:
"""execute code to put recyclable into the paper bin"""
elif recyclable is plastic:
"""execute code to put recyclable into the plastic bin"""
else:
raise TypeError("item not recyclable")
...But there's an easier and cleaner way to do it.


Never, never, never: When Devendra Fadnavis said this on forming alliance with NCP
In September 2014, Devendra Fadnavis in a tweet had said the BJP will "never, never, never" form any alliance with the NCP because it is corrupt.
While Devendra Fadnavis may have his reasons to shake hands with NCP's Ajit Pawar and take his support to form the next government in Maharashtra, five years ago, the same Devendra Fadnavis had said the BJP will "never, never, never" form any alliance with the NCP.
The reason, Fadnavis said, was that NCP is corrupt.
"BJP will never, never, never have any alliance with NCP. Rumours are motivated. We exposed their corruption in assembly. Others were silent," Devendra Fadnavis had said in a tweet in September 2014.
In the run-up to this year's Maharashtra assembly election, the BJP had launched scathing attacks on Ajit Pawar, who is facing investigations in a Rs 20,000-crore irrigation scam that allegedly took place during his tenure as Maharashtra's water resource minister.
Follow live updates from Maharashtra
On Saturday, the political landscape of Maharashtra turned topsy-turvy after the BJP and a faction of the NCP, under the leadership of Ajit Pawar, joined hands to form government. BJP's Devendra Fadnavis took oath as chief minister and NCP's Ajit Pawar as deputy chief minister.
The move took everyone by surprise because until Friday night, the NCP, Congress and Shiv Sena were all set to form government to ensure BJP is kept out of power.
Ever since the news broke out early morning, Twitter has been abuzz with people digging out old Fadnavis' old tweet against the NCP to portray his dramatic change in stand.
 In one such tweet, Devendra Fadnavis had said: "Adarsh (housing society scam) report rejected by the cabinet. Corrupt face of Congress NCP exposed. BJP will not spare any1. We will go to legal n people's court (sic)."
These tweets provided sufficient ammunitions for Twitterati to have a field's day in the backdrop of Maharashtra's rapidly changing political landscape.
One user wrote: "In politics never ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever....say never."
Another cheekily remarked: "@Dev_Fadnavis lol sir delete the tweet immediately nahi to muh dikhana mushkil ho jayega twitter par."
One user commented: "Ah, politics. Why do we even subscribe to Netflix when the content here is so good."
(With inputs from IANS)


Project components
Repos Search sources contain the following components:
- hook script to be called from subversion repository's post-commit
- jettysolr Jetty server with solr.war as a quick start indexing server
- solrhome is the configuration for indexing, the "schema"
- repos-search is the HTML and Ajax part of the solution as a reference UI
- /index.html the homepage


Lang Live Official Website
Lang Live provides live streaming services originally in mobile devices. Now, our team created an official website for users to view live-streaming through desktop. Important functions of Lang Live are included in the official website.As the lead designer of this project, I worked through Competitor Research and designed the overall user interface.
Role: Lead Product Designer
Type: Web Design
Year: 2020.03 ~ now
Produced by Lang Live
Art Director: Xin Xu
Product Designer: Yen-Len Chen
Type: Web Design
Year: 2020.03 ~ now
Produced by Lang Live
Art Director: Xin Xu
Product Designer: Yen-Len Chen
Design Process
Home Page
Live Streaming Page
Important functions of live streaming, such as chat room, gifts, profile, video list are included.


{% from "commons/forms/input.html" import form_input with context %} {% from "commons/forms/input_search_list.html" import input_search_list with context %} {% from "commons/forms/select_list.html" import select_list with context %} {% from "commons/forms/multiple_select_list.html" import multiple_select_list with context %} {% from "commons/components/card.html" import card with context %} {% extends "commons/layout.html" %} {% block title %}{{ title }}{% endblock %} {% block head %} {% endblock %} {% block h1 %}{{ title }}{% endblock %} {% block h1_side %}
{% endblock %} {% block content %}


To check header with user:
Make sure to have the community running on
lvh.me:3000
Check console to see output of header events