Skip to content

Commit c12db90

Browse files
author
jaime-m-p
committed
Get rid of BOM
1 parent a9d8329 commit c12db90

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

unicode.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ static std::array<codepoint_flags, MAX_CODEPOINTS> unicode_cpt_flags_array() {
144144

145145
static std::unordered_map<uint8_t, std::string> unicode_byte_to_utf8_map() {
146146
std::unordered_map<uint8_t, std::string> map;
147-
for (int ch = u'!'; ch <= u'~'; ++ch) {
147+
for (int ch = 0x21; ch <= 0x7E; ++ch) { // u'!' to u'~'
148148
assert(0 <= ch && ch < 256);
149149
map[ch] = unicode_cpt_to_utf8(ch);
150150
}
151-
for (int ch = u'¡'; ch <= u'¬'; ++ch) {
151+
for (int ch = 0xA1; ch <= 0xAC; ++ch) { // u'¡' to u'¬'
152152
assert(0 <= ch && ch < 256);
153153
map[ch] = unicode_cpt_to_utf8(ch);
154154
}
155-
for (int ch = u'®'; ch <= u'ÿ'; ++ch) {
155+
for (int ch = 0xAE; ch <= 0xFF; ++ch) { // u'®' to u'ÿ'
156156
assert(0 <= ch && ch < 256);
157157
map[ch] = unicode_cpt_to_utf8(ch);
158158
}
@@ -168,15 +168,15 @@ static std::unordered_map<uint8_t, std::string> unicode_byte_to_utf8_map() {
168168

169169
static std::unordered_map<std::string, uint8_t> unicode_utf8_to_byte_map() {
170170
std::unordered_map<std::string, uint8_t> map;
171-
for (int ch = u'!'; ch <= u'~'; ++ch) {
171+
for (int ch = 0x21; ch <= 0x7E; ++ch) { // u'!' to u'~'
172172
assert(0 <= ch && ch < 256);
173173
map[unicode_cpt_to_utf8(ch)] = ch;
174174
}
175-
for (int ch = u'¡'; ch <= u'¬'; ++ch) {
175+
for (int ch = 0xA1; ch <= 0xAC; ++ch) { // u'¡' to u'¬'
176176
assert(0 <= ch && ch < 256);
177177
map[unicode_cpt_to_utf8(ch)] = ch;
178178
}
179-
for (int ch = u'®'; ch <= u'ÿ'; ++ch) {
179+
for (int ch = 0xAE; ch <= 0xFF; ++ch) { // u'®' to u'ÿ'
180180
assert(0 <= ch && ch < 256);
181181
map[unicode_cpt_to_utf8(ch)] = ch;
182182
}

0 commit comments

Comments
 (0)