Table 2-4. The Seven Unicode Encoding Schemes Encoding Scheme: UTF-8 Endian Order: N/A BOM Allowed?: yes 0012デフォルトの名無しさん2023/03/05(日) 10:24:42.19ID:Dqp2Pk7H The Unicode® Standard Version 15.0 – Core Specification https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf
When converting between different encoding schemes, extreme care must be taken in handling any initial byte order marks. For example, if one converted a UTF-16 byte serialization with an initial byte order mark to a UTF-8 byte serialization, thereby converting the byte order mark to <EF BB BF> in the UTF-8 form, the <EF BB BF> would now be ambiguous as to its status as a byte order mark (from its source) or as an initial zero width no break space. If the UTF-8 byte serialization were then converted to UTF-16BE and the initial <EF BB BF> were converted to <FE FF>, the interpretation of the U+FEFF character would have been modified by the conversion. This would be nonconformant behavior according to conformance clause C7, because the change between byte serializations would have resulted in modification of the interpretation of the text. This is one reason why the use of the initial byte sequence <EF BB BF> as a signature on UTF-8 byte sequences is not recommended by the Unicode Standard. 0013デフォルトの名無しさん2023/03/05(日) 10:24:58.61ID:dEWQ/p/B>>10 ASCIIは文字コードで言えば0~127までの文字 UTF-8が使う128~255はASCII互換ではない
In UTF-8, the BOM corresponds to the byte sequence <EF BB BF>. Although there are never any questions of byte order with UTF-8 text, this sequence can serve as signature for UTF-8 encoded text where the character set is unmarked. (中略) For compatibility with versions of the Unicode Standard prior to Version 3.2, the code point U+FEFF has the word-joining semantics of zero width no-break space when it is not used as a BOM. In new text, these semantics should be encoded by U+2060 word joiner. See “Line and Word Breaking” in Section 23.2, Layout Controls, for more information. 0044デフォルトの名無しさん2023/03/06(月) 10:05:23.97ID:OTf/Royi BOMというのはバイトオーダーマークの略で リトルエンディアンかビッグエンディアンか区別するためのもの UTF-8では必要ない これはWindowsのメモ帳のバグでM$がUTF-8にBOMをつけたのが始まり 仕方ないからUnicodeで許可されてるだけで本来はつけてはいけない 0045デフォルトの名無しさん2023/03/06(月) 11:39:19.84ID:VJJWQXML>>44 ついてた時にどうするかが重要なのであって、そこが自由裁量であり経営判断。 Windowsの資産をすべて捨てる決断をするのはカネを払う経営者やユーザーであって技術者ではない。 0046デフォルトの名無しさん2023/03/06(月) 11:42:21.59ID:VJJWQXML 山茶花(サザンカ)は本来サンザカと読まなければならないのだから、今後はサザンカは受け付けない(キリッ 0047デフォルトの名無しさん2023/03/06(月) 11:50:48.53ID:OTf/Royi>>45 お前のようなやつがいるからWindowsはいつまでもShiftJISを使い続けることになる BOMはUnicodeでは認められていない。禁止すべきものだ。 0048デフォルトの名無しさん2023/03/06(月) 11:51:31.28ID:M8d550bg>>45 入力がBOMつきUTF-8に指定されている場合はBOMとして処理しろ。 入力がBOMなしUTF-8に指定されている場合はZWNBSとして処理しろ。 0049デフォルトの名無しさん2023/03/06(月) 12:05:50.90ID:lfXpWlV+>>47 推奨されてなくても一応認められてるでしょ 何でそこを捻じ曲げるの 0050デフォルトの名無しさん2023/03/06(月) 12:36:46.99ID:VJJWQXML ま、積極的にBOMを使うのが運用として自然だから、BOMをつけるアプリがドンドン増える。 デファクトスタンダード。 0051デフォルトの名無しさん2023/03/06(月) 14:23:24.15ID:diWxUEyJ>>19 >Zero Width Non-Breakable Space (ここで改行禁止くらいの意味)