ruby / stringio

Pseudo `IO` class from/to `String`.
BSD 2-Clause "Simplified" License
33 stars 26 forks source link

Convert rs to match stringio encoding #80

Open nobu opened 8 months ago

nobu commented 8 months ago

Fix #78

kou commented 8 months ago

The current behavior is compatible with IO:

str = "\xFE\xFFColumn1,Column2\n" + "\"value1.1\",value1.2\n"
File.write("/tmp/xxx.txt", str)
File.open("/tmp/xxx.txt", "rb", encoding: "utf-16") do |io|
  io.gets *["\n", 8192]
end

If we want to change the behavior, we may want to change the IO's behavior too.

kou commented 8 months ago

FYI: https://github.com/ruby/ruby/blob/42168802618381b7b6308acc290aabdf61c10116/io.c#L4085-L4087