Created
November 9, 2012 13:51
-
-
Save jcoyne/4045742 to your computer and use it in GitHub Desktop.
Setting default internal_encoding causes Encoding::UndefinedConversionError when writing to popen2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open3' | |
Encoding.default_internal = Encoding::UTF_8 # works fine if this line is removed | |
file = File.open('sample.mp3', 'rb') | |
stdin, stdout, wait_thr = Open3.popen2('mpg321 - -w -|oggenc -') | |
stdin.write file.read | |
stdin.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test_popen.rb:5:in
'write': "\x89" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError) from test_popen.rb:7:in