Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | add BOM.none |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8d26af00d92db60c78b6dbe59cd75781 |
User & Date: | admin 2021-10-03 08:14:23 |
Context
2021-10-16
| ||
13:57 | chrestomathy: add ziglang.org json parsing example check-in: 5bc84a2526 user: admin tags: trunk | |
2021-10-03
| ||
08:14 | add BOM.none check-in: 8d26af00d9 user: admin tags: trunk | |
08:10 | add basics/unicode_ops.d check-in: 7187a3dbcd user: admin tags: trunk | |
Changes
Changes to basics/unicode_ops.d.
131 132 133 134 135 136 137 138 139 140 141 142 |
unittest {
import std.encoding : getBOM, BOM, bomTable;
import std.string : representation;
enum s1 = "\x84\x31\x95\x33<- GB-18030".representation;
enum s2 = "\xEF\xBB\xBF<- UTF-8".representation;
enum s3 = "\xFF\xFE<- UTF-16 (LE)".representation;
assert(s1[s1.getBOM.sequence.length .. $] == "<- GB-18030"); // stripping
assert(s2 == bomTable[BOM.utf8].sequence ~ "<- UTF-8".representation); // adding
assert(BOM.utf16le == s3.getBOM.schema); // checking
}
|
> | > |
131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
unittest { import std.encoding : getBOM, BOM, bomTable; import std.string : representation; enum s1 = "\x84\x31\x95\x33<- GB-18030".representation; enum s2 = "\xEF\xBB\xBF<- UTF-8".representation; enum s3 = "\xFF\xFE<- UTF-16 (LE)".representation; enum s4 = "no BOM here".representation; assert(s1[s1.getBOM.sequence.length .. $] == "<- GB-18030"); // stripping assert(s2 == bomTable[BOM.utf8].sequence ~ "<- UTF-8".representation); // adding assert(BOM.utf16le == s3.getBOM.schema); // getting assert(s4.getBOM.schema == BOM.none); // checking } |