Closed davispuh closed 10 years ago
Hi @davispuh
I'm updating the Changelog for preparing for the next version release. As you have merged code on this release, we should put credits on the Changelog. How would you like to be called on the Changelog?
for me it doesn't really matter, you can just write davispuh
:+1:
@davispuh you can check the Changelog https://github.com/JEG2/highline/blob/master/Changelog.md
Fix correct encoding of statements to output encoding (Dāvis (davispuh), #110)
This resolves #108
It's a shame that people so often get it wrong. Basically idea is that as soon as you receive input from "outside" encode it in your preferred internal encoding (eg. UTF8) then process everything and finally encode it back to encoding which is wanted by "outside".
In this case in Ruby code we use and process UTF8, but when we need to output text we encode it in respective encoding. Obviously if we use some Unicode characters in our code and if "outside" uses just ASCII they'll be "?" but that's not our problem.
I wonder why
@output.print
doesn't do this automagically, because it knows that output encoding is different than one we pass to print so IMO it should either encode it or raise exception. It looks like Ruby's bug. Then 620 line wouldn't be needed.By the way, I haven't checked other places. This fixes only
say
proper output.