Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Byte order mark
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===UTF-16=== In [[UTF-16]], a BOM (<code>U+FEFF</code>) may be placed as the first bytes of a file or character stream to indicate the endianness (byte order) of all the 16-bit [[Character encoding#Terminology|code units]] of the file or stream. If an attempt is made to read this stream with the wrong endianness, the bytes will be swapped, thus delivering the character <code>U+FFFE</code>, which [[Specials (Unicode block)|is defined]] by Unicode as a "[[{{Proper name|noncharacter}}]]" that should never appear in the text. * If the 16-bit units are represented in [[big-endian]] byte order ("UTF-16BE"), the BOM is the ([[hexadecimal]]) byte sequence <code>FE FF</code> * If the 16-bit units use [[little-endian]] order ("UTF-16LE"), the BOM is the ([[hexadecimal]]) byte sequence <code>FF FE</code> For the [[Internet Assigned Numbers Authority|IANA]] registered charsets UTF-16BE and UTF-16LE, a byte-order mark should not be used because the names of these character sets already determine the byte order. If there is no BOM, it is possible to guess whether the text is UTF-16 and its byte order by searching for ASCII characters (i.e. a 0 byte adjacent to a byte in the 0x20-0x7E range, also 0x0A and 0x0D for CR and LF). A large number (i.e. far higher than random chance) in the same order is a very good indication of UTF-16 and whether the 0 is in the even or odd bytes indicates the byte order. However, this can result in ''both'' false positives and false negatives. Clause D98 of conformance (section 3.10) of the Unicode standard states, "The UTF-16 encoding scheme may or may not begin with a BOM. However, when there is no BOM, and in the absence of a higher-level protocol, the byte order of the UTF-16 encoding scheme is big-endian." Whether or not a higher-level protocol is in force is open to interpretation. Files local to a computer for which the native byte ordering is little-endian, for example, might be argued to be encoded as UTF-16LE implicitly. Therefore, the presumption of big-endian is widely ignored. The [[W3C]]/[[Comparison of web browser engines (HTML support)|WHATWG]] encoding standard used in HTML5 specifies that content labelled either "utf-16" or "utf-16le" are to be interpreted as little-endian "to deal with deployed content".<ref>{{cite web | url=https://encoding.spec.whatwg.org/#utf-16le | title=UTF-16LE | publisher=WHATWG | work=Encoding Standard}}</ref> However, if a byte-order mark is present, then that BOM is to be treated as "more authoritative than anything else".<ref>{{cite web | url=https://encoding.spec.whatwg.org/#decode | title=Decode | publisher=WHATWG | work=Encoding Standard}}</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Byte order mark
(section)
Add topic