Uppercase S with caronLowercase e with grave accent
ASCII 138 is Š on Windows and è in old DOS.
Š (Capital S with Caron) is byte 138 in Windows-1252, Unicode U+0160. The caron (háček in Czech) turns s into an sh sound in Czech, Slovak, Croatian and Lithuanian, as in Škoda and Šibenik. A useful detail when you're guessing a file's encoding: Š is byte 138 in Windows-1250, the Central European code page, as well. So Czech text read with the wrong one of the two keeps its Š while other letters break. ř, for example, is 0xF8 in Windows-1250, which Windows-1252 shows as ø. In UTF-8, Š is C5 A0, garbled as Å followed by a non-breaking space. Lowercase š is byte 154. The HTML entity is Š.
è (Small E with Grave) is byte 138 in code page 437, the original IBM PC character set, and maps to Unicode U+00E8. Windows-1252 has Š at 138, so Italian DOS text read as Windows-1252 turns è vero into Š vero and caffè into caffŠ. Code page 850 kept è at 138 too. Code page 437 has no capital È, and code page 850 added one at 212.
#include <stdio.h>int main(void) {/* On Windows (code page 1252) byte 138 is Š.Modern terminals expect UTF-8, so print the code point, not the byte. */printf("\u0160\n"); /* UTF-8: C5 A0 */unsigned char b = 138; /* the raw Windows-1252 byte */printf("%d 0x%02X\n", b, b); /* 138 0x8A */return 0;}
#include <stdio.h>int main(void) {/* Byte 138 is è only on a console using code page 437(chcp 437 on Windows, or DOSBox). On a UTF-8 terminal thelone byte 0x8A is invalid and prints as garbage, often �. */putchar(138);/* char is signed on x86, so a plain char holding 0x8A is -118.Use unsigned char when you compare or index by byte value. */char c = (char)138;unsigned char u = 138;printf("\n%d %d\n", c, u); /* -118 138 *//* Portable: print the Unicode character as UTF-8 instead. */printf("\u00E8\n"); /* C3 A8 */return 0;}
è is also ASCII 232 on Windows, which has the full guide.
Those two bytes are Š in UTF-8, and your database or client encoding is LATIN1, which is true ISO-8859-1 and has no Š. Windows-1252 does have it, so the text looked fine until it reached Postgres. The lasting fix is a UTF8 database. If you're stuck with a single-byte encoding for Czech or Croatian text, WIN1250 covers Š and the other letters those languages need.
Ш. Serbian Latin and Cyrillic match letter for letter, so š and ш swap cleanly in both directions. The catch is three Latin digraphs, lj, nj and dž, which each stand for a single Cyrillic letter (љ, њ, џ). A converter that goes one character at a time handles Š fine but breaks those.
It's the word è. In code page 437 è is byte 138, which Windows-1252 reads as Š, so Questo è vero turns into Questo Š vero. French text breaks the same way, with très becoming trŠs. In Go, decode the file with `charmap.CodePage437.NewDecoder().Bytes(data)` from golang.org/x/text.
It's the word è. In code page 437 è is byte 138, which Windows-1252 reads as Š, so Questo è vero turns into Questo Š vero. French text breaks the same way, with très becoming trŠs. In Go, decode the file with `charmap.CodePage437.NewDecoder().Bytes(data)` from golang.org/x/text.