Representations

  • 0x : Hexadecimal integer literal

    • "Interpret this number as hexadecimal."

    • It doesn't inherently mean Unicode or text.

    0x00000041  -> A
    0x000000E9  -> é
    0x0001F600  -> 😀
    
  • 0b : Binary integer literal.

    • "Interpret this number as binary."

    • It doesn't inherently mean Unicode or text.

    0b01000001  -> A
    0b11101001  -> é
    0b00011111101100000000  -> 😀
    
  • 0o : Octal integer literal

    0o000101  -> A
    0o000351  -> é
    0o177000  -> 😀
    
  • '\u' : Unicode escape

    • "The following hexadecimal digits specify a Unicode code point."

    \u0041  -> A
    \u00E9  -> é
    \u1F600 -> 😀
    
  • '\U' : Unicode escape, larger range

    • "The following hexadecimal digits specify a Unicode code point."

    \U00000041  -> A
    \U000000E9  -> é
    \U0001F600  -> 😀
    
  • '\x' : Hexadecimal byte/character escape

    • "The following hexadecimal digits specify a byte/character value."

    \x41  -> A
    \xE9  -> é
    
    • \x  is typically byte-sized, so 😀  cannot be represented by a single \x  escape, and é  depends on the encoding.

  • '\o : Octal character escape

    \o000101  -> A
    \o000351  -> é
    \o177000  -> 😀
    
  • '\N{...}' : Unicode character by name

    • Supported by some languages

    \N{LATIN CAPITAL LETTER A}          -> A
    \N{LATIN SMALL LETTER E WITH ACUTE} -> é
    \N{GRINNING FACE}                   -> 😀
    

Common Unicode Characters

Unicode whitespace characters
  • '\t'  / '\u0009' : CHARACTER TABULATION

  • '\n'  / '\u000A' : LINE FEED (LF)

  • '\v'  / '\u000B' : LINE TABULATION

  • '\f'  / '\u000C' : FORM FEED

  • '\r'  / '\u000D' : CARRIAGE RETURN

  • ' '  / ' \u0020' : SPACE

  • 0x0085  / '\u0085' : NEXT LINE (NEL)

  • 0x00A0  / '\u00A0' : NO LINE BREAK SPACE

  • 0x1680  / '\u1680' : OGHAM SPACE MARK

  • 0x200A  / '\u200A' : HAIR SPACE

  • 0x2028  / '\u2028' : LINE SEPARATOR

  • 0x2029  / '\u2029' : PARAGRAPH SEPARATOR

  • 0x202F  / '\u202F' : NARROW NO-BREAK SPACE

  • 0x205F  / '\u205F' : MEDIUM MATHEMATICAL SPACE

  • 0x3000  / '\u3000' : IDEOGRAPHIC SPACE