Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spawn::Child should support encodings properly under 1.9 #4

Open
rtomayko opened this issue Mar 19, 2011 · 0 comments
Open

Spawn::Child should support encodings properly under 1.9 #4

rtomayko opened this issue Mar 19, 2011 · 0 comments

Comments

@rtomayko
Copy link
Owner

Right now we're forcing the encoding of the input string to BINARY and also setting the output streams to BINARY for reads. See:

af16f2a

To be consistent with Ruby's core IO methods we'd need to.

  1. Accept input in any encoding and transcode to Encoding::default_external or a user-specified external encoding when writing to the stdin fd.
  2. Read data off of the stdout/stderr assuming the default Encoding::default_external or user-specified external_encoding and transcode to the Encoding::internal_encoding.
  3. Add support for overriding the default external/internal encodings as options to Child::new.

One weird thing I noticed when working on this previously is that IO#readpartial and IO#write_nonblock seem to ignore the IO object's encoding, unlike the IO#read and IO#write methods. We get BINARY encoded data out no matter what the external/internal encoding is set to. Something to look into when we fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant