Use +"" or "".dup rather than String.new, unless you specifically want a string with binary encoding – the former will use the interpreter default, the latter will not.
+""
"".dup
String.new
Use
+""or"".duprather thanString.new, unless you specifically want a string with binary encoding – the former will use the interpreter default, the latter will not.