Skip to content

Instantly share code, notes, and snippets.

@brixen
Created January 19, 2012 04:33
Show Gist options
  • Save brixen/1637933 to your computer and use it in GitHub Desktop.
Save brixen/1637933 to your computer and use it in GitHub Desktop.
sasha:rubinius brian$ irb
ruby-1.9.3-p0 :001 > __ENCODING__
=> #<Encoding:UTF-8>
ruby-1.9.3-p0 :002 > s = "\u{61}"
=> "a"
ruby-1.9.3-p0 :003 > s.encoding
=> #<Encoding:UTF-8>
ruby-1.9.3-p0 :004 > re = Regexp.new s
=> /a/
ruby-1.9.3-p0 :005 > re.encoding
=> #<Encoding:US-ASCII>
ruby-1.9.3-p0 :006 > re.source.encoding
=> #<Encoding:US-ASCII>
ruby-1.9.3-p0 :007 >
@gusgollings
Copy link

Although

"\u{2714}".encoding
=> #Encoding:UTF-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment