-
-
Save Burgestrand/693b65b0a7aae28294a271150c19dee7 to your computer and use it in GitHub Desktop.
This file contains 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
# Ruby has to assume the input comes in a specific encoding. The encoding it | |
# *actually* comes in as depends on your system, possibly in the LOCALE env? | |
STDIN.set_encoding(Encoding::UTF_8) | |
require "io/console" # for IO#getch | |
c = STDIN.getch | |
puts c | |
puts c.bytesize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment