Created
April 6, 2019 21:07
-
-
Save dmaestro/632344ac73d1f2be8ddf4448cf479c75 to your computer and use it in GitHub Desktop.
Question by Eric Lindblad about perl 6 and terminal encoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doug@ender:~/study$ perl6 -e 'say "Hôtel"' | |
Hô¿½xF4tel | |
doug@ender:~/study$ perl6 -e 'say "Hôtel".chars' | |
5 | |
doug@ender:~/study$ perl6 -e 'say "Hôtel"' | od -Ax -t x1 | |
000000 48 f4 8f bf bd 78 46 34 74 65 6c 0a | |
00000c | |
doug@ender:~/study$ perl6 -e 'utf8.new(0xF4, 0x8f, 0xbf, 0xbd).Str.ord.&{ "%x".sprintf($_) }.say' | |
10fffd | |
doug@ender:~/study$ perl6 -e 'utf8.new(0xF4, 0x8f, 0xbf, 0xbd).Str.uniname.say' | |
<private-use-10FFFD> | |
doug@ender:~/study$ perl6 -e 'say "Hôtel".codes' | |
8 | |
doug@ender:~/study$ locale | |
LANG=en_US | |
LC_CTYPE="en_US" | |
LC_NUMERIC="en_US" | |
LC_TIME="en_US" | |
LC_COLLATE="en_US" | |
LC_MONETARY="en_US" | |
LC_MESSAGES="en_US" | |
LC_PAPER="en_US" | |
LC_NAME="en_US" | |
LC_ADDRESS="en_US" | |
LC_TELEPHONE="en_US" | |
LC_MEASUREMENT="en_US" | |
LC_IDENTIFICATION="en_US" | |
LC_ALL=en_US | |
doug@ender:~/study$ perl6 -e '$*OUT.encoding("Latin-1"); say "Hôtel"' | |
Error encoding Latin-1 string: could not encode codepoint 1114109 | |
in block <unit> at -e line 1 | |
doug@ender:~/study$ vi bytes.txt | |
doug@ender:~/study$ cat bytes.txt | |
Hôtel | |
doug@ender:~/study$ od -Ax -t x1 bytes.txt | |
000000 48 f4 74 65 6c 0a | |
000006 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment