>>237
File.open( "foo.txt", "w:CP932" ){|fh| fh.puts("ソ") }
File.open( "bar.txt", "w:CP932" ){|fh| fh.print("ソ") }
File.open( "car.txt", "w:UTF-8" ){|fh| fh.print("\u4E0A") }
File.open( "foo.txt", "r:CP932" ){|fh| fh.seek(fh.size-1); puts fh.read(1).start_with?("\r","\n") }
File.open( "bar.txt", "r:CP932" ){|fh| fh.seek(fh.size-1); puts fh.read(1).start_with?("\r","\n") }
File.open( "car.txt", "r:UTF-8" ){|fh| fh.seek(fh.size-1); puts fh.read(1).start_with?("\r","\n") }
UTF-16やUTF-32等のファイルがあるなら対策すること。