|
Enhanced C#
Loyc library documentation
|
An Encoding for WTF-8: UTF-8 extended so that unpaired UTF-16 surrogates are encoded as themselves (3 bytes, ED A0-BF 80-BF) instead of being replaced with U+FFFD. This makes every .NET string round-trippable, which Encoding.UTF8 does not guarantee. See https://simonsapin.github.io/wtf-8/ More...
An Encoding for WTF-8: UTF-8 extended so that unpaired UTF-16 surrogates are encoded as themselves (3 bytes, ED A0-BF 80-BF) instead of being replaced with U+FFFD. This makes every .NET string round-trippable, which Encoding.UTF8 does not guarantee. See https://simonsapin.github.io/wtf-8/
Well-formed UTF-8 input/output is unchanged, so this is a drop-in replacement for UTF-8 without byte order marks. Decoding treats surrogate sequences as valid; other malformed bytes become U+FFFD as usual. Encoding is delegated to Encoding.UTF8 for surrogate-free spans, so speed is close to UTF-8 except on strings that actually contain surrogates.
Public fields | |
| override string | EncodingName => "WTF-8" |
| override string | WebName => "wtf-8" |
Public static fields | |
| static readonly WTF8Encoding | Instance = new WTF8Encoding() |
1.8.7