On 21 June 2014 00:14, James French <James.French / naturalmotion.com> wrote:

> Thank you Abinoam and Matthew. Incredibly useful. It doesn¡Çt appear that
> you can pass the encoding in up front with Open3.popen3 but I was able to
> change my io processing code to
>
>
>
>       chunk = io.readpartial(4096)
>
>       chunk.encode!(Encoding::UTF_8, external_encoding) if
> external_encoding
>
>       buffer << chunk
>
>
>
> Where external_encoding was UTF16-LE and it fixed my problem.
>
>
>

The only issue to watch for here is: what happens if you have a surrogate
pair split over that 4096-byte boundary? The chunk.encode! line will
probably fail.  Granted, it's not likely if your output is normal text from
the BMP, but still something to watch for.


Very grateful for that great help!
>
>
>

No worries.


-- 
  Matthew Kerwin
  http://matthew.kerwin.net.au/