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
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" |
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
str = "a utf-8 string (\u20AC) with utf-8 chars".force_encoding("utf-8") | |
str2 = "This string is #{str} but looks like ascii-only" | |
puts "str: #{str}" | |
puts "str.ascii_only?: #{str.ascii_only?}" # => false | |
puts "str2: #{str2}" | |
puts "str2 encoding: #{str2.encoding}" # => UTF-8 | |
puts "str2.ascii_only?: #{str2.ascii_only?}" # => true | |
puts "str2.dup.ascii_only?: #{str2.dup.ascii_only?}" | |
puts "<< broken encoding:" | |
str3 = "an ascii string with " |
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
rbx-head --trace | |
rvm 1.16.15 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/] | |
+__rvm_parse_args:639> [[ -n 4.3.11 ]] | |
+__rvm_parse_args:674> [[ -z reinstall ]] | |
+__rvm_parse_args:677> [[ error == reinstall || 0 -eq 1 || -n '' ]] | |
+__rvm_parse_args:16> [[ -n '' ]] | |
+__rvm_parse_args:682> : rvm_ruby_args:0:: | |
+__rvm_parse_args:684> [[ -n '' ]] |
NewerOlder