| Age | Commit message (Collapse) | Author |
|
The behavior is different from CRuby, but we believe this is a right
behavior for mruby, which only supports either ASCII or UTF-8
exclusively; fix #4983, ref #4982
```
$ printf '\xe3\x81' | ruby -e 'p STDIN.readchar'
"\xE3\x81"
```
```
$ printf '\xe3\x81' | mruby -e 'p STDIN.readchar'
"\xE3"
```
|
|
This fix only effective when `MRB_UTF8_STRING` is set.
|
|
The bug was introduced by #4712. The `getc' problem resurrected.
It should be addressed soon.
|
|
|
|
Support bit flags for `IO.open`
|
|
Note that this bit flags are not compatible with the native flags
defined in `#include <fcntl.h>`.
|
|
And rename `File.concat_path` to `File._concat_path`.
|
|
`Kernel#getc` has been removed since Ruby 1.9 and is not defined in ISO.
|
|
|
|
|
|
|
|
|
|
Character (multi-byte UTF-8) is destroyed when character spanning
`IO::BUF_SIZE` (4096 bytes) exist.
- Prepare file:
```ruby
File.open("sample", "wb") { |f| f << "●" * 1370 }
```
- Before patched:
```ruby
File.open("sample") { |f| a = []; while ch = f.getc; a << ch; end; p a }
# => ["●", "●", ..., "●", "\xe2", "\x97", "\x8f", "●", "●", "●", "●"]
- After patched:
```ruby
File.open("sample") { |f| a = []; while ch = f.getc; a << ch; end; p a }
# => ["●", "●", ..., "●", "●", "●", "●", "●", "●"]
|
|
|
|
|
|
`IO#readline` and `IO#readchar` process in character units.
|
|
`byteslice` creates 2 string objects. `_bufread` creates one, and
modifies the original buffer string, that is more efficient.
|
|
1. `$/` and other Perl-ish global variables are not defined in ISO.
2. The current Ruby policy do not encourage those variables.
3. Those variables has global effect and can cause troubles.
|
|
E.g. `io.read(5)` should read 5 byte string, not 5 characters.
|
|
|
|
git-subtree-dir: mrbgems/mruby-io
git-subtree-mainline: 10ed730e4bd921cf4d8fe6f6d2e3cb3f0840f3b7
git-subtree-split: 3c8e1f94c44252c836f79a48bb17726da28e2756
|