Superscript twoDark shade
ASCII 178 is ² on Windows and ▓ in old DOS.
² (Superscript Two) is byte 178 in Windows-1252, Unicode U+00B2. It writes squares in plain text: m², km², E = mc². Python has a trap for it. '5²'.isdigit() returns True, because Unicode counts superscripts as digits, but int('5²') raises ValueError. So an input check built on isdigit() lets the value through and the conversion crashes a line later. Use isdecimal(), which returns False for ², or strip superscripts before parsing. In HTML, ² is an ordinary character and keeps line spacing even, while a 2 wrapped in a sup element can push the lines around it apart. Old DOS had ² too, at 253. In UTF-8 it's C2 B2, which misreads as ². The HTML entity is ².
▓ (Dark Shade) is byte 178 in code page 437, the original IBM PC character set, and maps to Unicode U+2593. It's the densest of the three shades, about three quarters filled, one step short of the solid █ at 219. C code that handles it as a byte has a classic bug. On x86 compilers plain char is signed, so char c = 178 actually stores -78, and a check like if (c == 178) is never true. Compare against (char)178, or read bytes as unsigned char, which also keeps functions like isalpha() from receiving a negative value they aren't defined for. In UTF-8 it's E2 96 93, which a code page 437 console prints as Γûô and a page misread as Windows-1252 shows as â–“. The HTML entity is ▓.
#include <stdio.h>int main(void) {/* On Windows (code page 1252) byte 178 is ².Modern terminals expect UTF-8, so print the code point, not the byte. */printf("\u00B2\n"); /* UTF-8: C2 B2 */unsigned char b = 178; /* the raw Windows-1252 byte */printf("%d 0x%02X\n", b, b); /* 178 0xB2 */return 0;}
#include <stdio.h>int main(void) {/* Byte 178 is ▓ only on a console using code page 437(chcp 437 on Windows, or DOSBox). On a UTF-8 terminal thelone byte 0xB2 is invalid and prints as garbage, often �. */putchar(178);/* char is signed on x86, so a plain char holding 0xB2 is -78.Use unsigned char when you compare or index by byte value. */char c = (char)178;unsigned char u = 178;printf("\n%d %d\n", c, u); /* -78 178 *//* Portable: print the Unicode character as UTF-8 instead. */printf("\u2593\n"); /* E2 96 93 */return 0;}
Because ¹, ² and ³ come from Latin-1, while ⁰ and ⁴ through ⁹ live in a separate Unicode block that starts at U+2070. A font can include the first three and skip the rest, and then ⁴ gets drawn from a fallback font with a different size and weight. Pick a font that covers that block, or write all exponents one way instead of mixing.
m² wherever you can type it, since that's the SI form. sq m is an informal English abbreviation that SI doesn't recognize. Where a field only takes plain ASCII, m2 and m^2 both get used, so pick one and keep it consistent through the whole document.
Because ² is a different character from 2, and plain string matching doesn't treat them as equal. NFKC normalization folds ² into 2, so normalize both the stored text and the query before comparing: in Python, `unicodedata.normalize('NFKC', text)` turns 80 m² into 80 m2. Keep the original for display and search the normalized copy.
isdigit() accepts any character Unicode counts as a digit, superscripts included, while int() only parses decimal digits. So a check like `if s.isdigit(): int(s)` crashes on input containing ². Use `s.isdecimal()` for the check instead, which returns False for ² and matches what int() actually accepts.
French AZERTY keyboards give ² a key of its own, top left, in the spot where US layouts have the backtick. So a shortcut documented as Ctrl+` sits on a key labeled ² in France, and French users hunting for a backtick key won't find one there.
The ▓ is the dark shade, which is what 178 means in the DOS table that Alt codes fall back to without a leading zero. Alt+0178 reads Windows-1252 and gives ², and in the DOS table the same sign is Alt+253. The other two superscripts work the same way with the zero: ¹ is Alt+0185 and ³ is Alt+0179.
Map each pixel onto a ramp that runs from empty to solid: `' ░▒▓█'[v * 5 // 256]` picks one of five characters for a value from 0 to 255. Terminal cells are roughly twice as tall as they are wide, so sample every second row of the image or the art comes out stretched. For dark text on a light background, reverse the ramp.
The ▓ is the dark shade, which is what 178 means in the DOS table that Alt codes fall back to without a leading zero. Alt+0178 reads Windows-1252 and gives ², and in the DOS table the same sign is Alt+253. The other two superscripts work the same way with the zero: ¹ is Alt+0185 and ³ is Alt+0179.