Skip to content

Instantly share code, notes, and snippets.

@rjsamson
Created November 3, 2012 14:02
Show Gist options
  • Save rjsamson/4007461 to your computer and use it in GitHub Desktop.
Save rjsamson/4007461 to your computer and use it in GitHub Desktop.
Illustration of Rubinius Encoding Issues with Substring Ranges
puts "Substring Range Test"
str = "utf-8 character (\u20AC) in a utf-8 string"
str2 = "normal ASCII-ONLY string"
puts "str: #{str}"
puts "str2: #{str2}"
puts "str[1...-1]: #{str[1...-1]}" # => "tf-8 character (€) in a utf-8 string"
puts "str2[1...-1]: #{str2[1...-1]}" # => "ormal ASCII-ONLY Strin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment