Skip to content
This repository

IO#getc and IO#ungetc in 1.9-mode #1847

Closed
tsion opened this Issue · 1 comment

2 participants

Scott Olson Brian Shirai
Scott Olson
Collaborator

In MRI 1.9, getc returns single-character Strings rather than Fixnums and ungetc works with both fixnums and strings.

In rbx 1.9-mode, getc returns Fixnums and ungetc works only with Fixnums. Even some code in kernel/common/io19.rb itself depends on the Fixnum-returning behaviour of getc.

I tried to fix getc myself but I think encodings make it more complicated, and I don't know anything about dealing with encodings.

Brian Shirai
Owner

This is rather complicated at the moment. IO uses an internal buffer that needs to be encoding aware for transcoding. Also, @evanphx is supposed to be rewriting the IO buffering implementation to address performance issues.

I'll see if I can patch something in so at least #getc works.

Brian Shirai brixen closed this issue from a commit
Brian Shirai brixen Fixed IO#getc, #ungetc for 1.9. Fixes #1847.
This is a hack. I will be replacing IO buffering soon.
b8c76e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.