Skip to content

Instantly share code, notes, and snippets.

@brianmario
Created January 13, 2011 18:16
Show Gist options
  • Save brianmario/778332 to your computer and use it in GitHub Desktop.
Save brianmario/778332 to your computer and use it in GitHub Desktop.
$KCODE = 'u'
utf8_str = "你好世界"
puts utf8_str[0..3] # => 你?
require 'utf8'
utf8_str = "你好世界"
puts utf8_str[0..3] # => 你好世界
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment