On Apr 19, 2010, at 3:31 AM, Brian Candler wrote:

> Code to demonstrate:
> 
>  str = "\xff"
>  File.open("out1","w") { |f| f.puts str }
>  File.open("out2","w:UTF-8") { |f| f.puts str }
> 
> Line 2 will never raise an exception, regardless of the content or the ncoding of str, and regardless of environment variable settings. It ust writes the string to the file.

That's grossly inaccurate.  You may not have write permission to the file, the volume you are trying to place the file on may be out of space, etc.

These are more examples of how you could move the same code to a new machine and have it fail.  Ignoring the environment code runs in will not make it go away.