public static function chr(int $codepoint): string
    {
        if ($codepoint <= 0x7F) {
            return \chr($codepoint);
        }
        
        if ($codepoint <= 0x7FF) {
            return \chr(0xC0 | $codepoint >> 6) . \chr(0x80 | $codepoint & 0x3F);
        }
        
        if ($codepoint <= 0xFFFF) {
            return \chr(0xE0 | $codepoint >> 12) . \chr(0x80 | $codepoint >> 6 & 0x3F) . \chr(0x80 | $codepoint & 0x3F);
        }
        
        if ($codepoint <= 0x10FFFF) {
            return \chr(0xF0 | $codepoint >> 18) . \chr(0x80 | $codepoint >> 12 & 0x3F) . \chr(0x80 | $codepoint >> 6 & 0x3F) . \chr(0x80 | $codepoint & 0x3F);
        }
        
        throw new \InvalidArgumentException('Unable to create character for unicode codepoint ' . $codepoint);
    }