Get each char in a unicode
$KCODE = "u" # Specify Unicode UTF-8, or start Ruby with -Ku option
require "jcode" # Load multibyte character support
mb = "2\303\2272=4" # This is "2×2=4" with a Unicode multiplication sign
mb.each_char do |c| # Iterate through the characters of the string
print c, " " # c is a String with jlength 1 and variable length
end # Outputs "2 × 2 = 4 "
Related examples in the same category