Lowercase o with strokeDegree sign
ASCII 248 is ø on Windows and ° in old DOS.
ø (Small O with Stroke) is byte 248 in Windows-1252, Unicode U+00F8. Danish and Norwegian write it in words like søster and brød, and Faroese uses it too. In phonetics ø is the IPA symbol for the rounded front vowel of French peu. Its garbled form is familiar to anyone who handles Danish data: UTF-8 stores ø as C3 B8, and B8 is the cedilla ¸ in Windows-1252, so København turns into København. Code page 437 had no ø at all. The HTML entity is ø.
° (Degree Sign) is byte 248 in code page 437, the original IBM PC character set, and maps to Unicode U+00B0. Windows-1252 has ø at 248, so temperatures from a DOS file read as Windows-1252 turn 25° into 25ø. Code page 850 kept ° at 248.
#include <stdio.h>int main(void) {/* On Windows (code page 1252) byte 248 is ø.Modern terminals expect UTF-8, so print the code point, not the byte. */printf("\u00F8\n"); /* UTF-8: C3 B8 */unsigned char b = 248; /* the raw Windows-1252 byte */printf("%d 0x%02X\n", b, b); /* 248 0xF8 */return 0;}
#include <stdio.h>int main(void) {/* Byte 248 is ° only on a console using code page 437(chcp 437 on Windows, or DOSBox). On a UTF-8 terminal thelone byte 0xF8 is invalid and prints as garbage, often �. */putchar(248);/* char is signed on x86, so a plain char holding 0xF8 is -8.Use unsigned char when you compare or index by byte value. */char c = (char)248;unsigned char u = 248;printf("\n%d %d\n", c, u); /* -8 248 *//* Portable: print the Unicode character as UTF-8 instead. */printf("\u00B0\n"); /* C2 B0 */return 0;}
° is also ASCII 176 on Windows, which has the full guide.
Soeren. The standard Danish and Norwegian fallback for ø is oe, and passports use it in the machine-readable line, so Ø becomes OE there too. Plain o turns up in URLs and email addresses, but it can merge different names, so keep oe wherever a name has to match an official document.
For ° you can type either Alt+248 or Alt+0176, and for ø it's Alt+0248, or Alt+0216 for Ø. The zero decides the table: without it Windows looks in the DOS code page, with it in Windows-1252, and the two tables put these characters in different slots.
A DOS-era program wrote the degree sign as a single byte, and the file is being read as Windows-1252, which shows that byte as ø. If the file holds no real Danish or Norwegian text, reopen it with a DOS code page, 437 or the European 850, and every degree sign comes back. If it does, only replace an ø that directly follows a digit.
For ° you can type either Alt+248 or Alt+0176, and for ø it's Alt+0248, or Alt+0216 for Ø. The zero decides the table: without it Windows looks in the DOS code page, with it in Windows-1252, and the two tables put these characters in different slots.
A DOS-era program wrote the degree sign as a single byte, and the file is being read as Windows-1252, which shows that byte as ø. If the file holds no real Danish or Norwegian text, reopen it with a DOS code page, 437 or the European 850, and every degree sign comes back. If it does, only replace an ø that directly follows a digit.