James Gray
4/16/2009 8:07:00 PM
On Apr 16, 2009, at 2:44 PM, Brian Candler wrote:
> James Gray wrote:
>>
>
> Consider an app which is bundled with HTML templates, which the app
> reads using File.read(). The templates happen to be written using, =20
> say,
> UTF-8. It all works fine on my machine, and passes all tests. =20
> However it
> barfs when run on someone else's machine, because their environment
> variables are different.
But you bundled those files. You know the encoding much better than =20
Ruby. Is it really too much to ask for?
html =3D File.read("my_template.html", external_encoding: "UTF-8")
That's more correct than any magic behavior would be and self-=20
documenting to boot.
> - File#read returns a string with encoding=3D'BINARY'
File.binread() was added for exactly this purpose.
>> Can you list what's not yet covered in my blog series?
>
> I've posted a bunch of lists before.
Yeah, I've read those. I responded to your last one yesterday telling =20=
you that I had no addressed all the concerns I saw in that one, plus =20
some more. I'm sure trying to help you.
I guess it's time for a new list of what you're still missing=85
> Trying out in irb used to be a good way to test ruby, but that's no =20=
> good
> in ruby 1.9 because it's not consistent with script behaviour.
While I agree that IRb may need some more integration, there has =20
always been some minor differences between how code runs in it and how =20=
it runs in a real Ruby script. I don't think this means 1.9 isn't =20
read for the masses.
James Edward Gray II=