Section signMasculine ordinal
ASCII 167 is § on Windows and º in old DOS.
§ (Section Sign) is byte 167 in Windows-1252, Unicode U+00A7. It cites a section of a law or contract: 18 U.S.C. § 1030, or § 242 BGB in German law, with §§ for several sections. The name trips people up across languages. German calls it the Paragraph sign, but the English paragraph sign is the pilcrow ¶ (byte 182), so a translated request for a paragraph symbol can mean either one. Put a non-breaking space between § and the number so a line break can't leave the § stranded at the end of a line. In UTF-8 it's C2 A7, and the HTML entity is §.
º (Masculine Ordinal) is byte 167 in code page 437, the original IBM PC character set, and maps to Unicode U+00BA. Windows-1252 has the section sign § at 167, so DOS text read as Windows-1252 turns Nº 5 into N§ 5. Code page 850 kept º at 167 too. Its feminine partner ª is the byte before, 166.
#include <stdio.h>int main(void) {/* On Windows (code page 1252) byte 167 is §.Modern terminals expect UTF-8, so print the code point, not the byte. */printf("\u00A7\n"); /* UTF-8: C2 A7 */unsigned char b = 167; /* the raw Windows-1252 byte */printf("%d 0x%02X\n", b, b); /* 167 0xA7 */return 0;}
#include <stdio.h>int main(void) {/* Byte 167 is º only on a console using code page 437(chcp 437 on Windows, or DOSBox). On a UTF-8 terminal thelone byte 0xA7 is invalid and prints as garbage, often �. */putchar(167);/* char is signed on x86, so a plain char holding 0xA7 is -89.Use unsigned char when you compare or index by byte value. */char c = (char)167;unsigned char u = 167;printf("\n%d %d\n", c, u); /* -89 167 *//* Portable: print the Unicode character as UTF-8 instead. */printf("\u00BA\n"); /* C2 BA */return 0;}
º is also ASCII 186 on Windows, which has the full guide.
The script sends UTF-8 text without saying so, and the mail client falls back to Windows-1252 or Latin-1, which turns the two bytes of § into §. Add `Content-Type: text/plain; charset=UTF-8` to the message headers (text/html for HTML mail), along with `MIME-Version: 1.0`, so the client knows what it's reading.
Without a leading zero, Windows reads Alt codes from the DOS code page, and there 167 is the masculine ordinal. Alt+0167 goes through Windows-1252 and gives §. There's also a shorter route: Alt+21 produces § as well, because the IBM PC drew § as the symbol for control code 21, and Windows still maps that Alt code to it.
The CSV came from a DOS-era system, and the import read it as Windows-1252, where the DOS º byte is §. Tell the importer the real encoding instead of patching the text. In MySQL that's `LOAD DATA INFILE 'data.csv' INTO TABLE t CHARACTER SET cp850`, and other importers usually call the same setting encoding or file origin.
Without a leading zero, Windows reads Alt codes from the DOS code page, and there 167 is the masculine ordinal. Alt+0167 goes through Windows-1252 and gives §. There's also a shorter route: Alt+21 produces § as well, because the IBM PC drew § as the symbol for control code 21, and Windows still maps that Alt code to it.
The CSV came from a DOS-era system, and the import read it as Windows-1252, where the DOS º byte is §. Tell the importer the real encoding instead of patching the text. In MySQL that's `LOAD DATA INFILE 'data.csv' INTO TABLE t CHARACTER SET cp850`, and other importers usually call the same setting encoding or file origin.