Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yujinakayama/ac6b20a2b34e0d215f38 to your computer and use it in GitHub Desktop.
Save yujinakayama/ac6b20a2b34e0d215f38 to your computer and use it in GitHub Desktop.
$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]
$ cat utf-8.rb
# coding: utf-8
p /./.encoding
p /\xff/.encoding
$ ruby utf-8.rb
utf-8.rb:3: invalid multibyte escape: /\xff/
$ cat us-ascii.rb
# coding: US-ASCII
p /./.encoding
p /\xff/.encoding
$ ruby us-ascii.rb
#<Encoding:US-ASCII>
#<Encoding:ASCII-8BIT>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment