On Sep 16, 2008, at 8:20 PM, Michael Selig wrote:

> ©Ăut UTF-16 is the problem - it breaks so many things, due to its  ASCII incompatibility" (using Ruby's definition). I can't even do  
> simple things like pull out fields and substitute into another  
> string without testing "encoding compatibility". Something as simple  s:
>
> 	puts "The value is #{val}"
>
> fails if val is UTF-16 data.

How ironic I ran into this issue about five minutes ago.  It's  
killing the CSV implementation I thought I finally had right.  :(

How would you save this?  Instead of:

   %Q{"#{val}"}  # boom for UTF-16!

Can we do:

   ['"', val, '"'].map { |s| s.encode("UTF-16BE") }.join

?  Yeah, that seems to work.  It sucks, but it works.