From b754d62f725210fc9bfdcd564e9fc96a20d965a6 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 12 Dec 2007 23:58:58 +0000 Subject: [PATCH] * io.c (rb_io_getc): use default external encoding if fptr->enc is not set. [ruby-dev:32565] * lib/rubygems/package.rb (Gem::TarReader::Entry::rewind): typo fixed. [ruby-dev:32565] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ io.c | 6 ++++-- lib/rubygems/package.rb | 2 +- lib/xsd/charset.rb | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 500e66e806..fe8fe2aaf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Dec 13 08:56:01 2007 Yukihiro Matsumoto + + * io.c (rb_io_getc): use default external encoding if fptr->enc is + not set. [ruby-dev:32565] + + * lib/rubygems/package.rb (Gem::TarReader::Entry::rewind): typo fixed. + [ruby-dev:32565] + Thu Dec 13 08:24:16 2007 Yukihiro Matsumoto * io.c (read_all): should associate default external encoding. diff --git a/io.c b/io.c index 5af2d493c6..fdea5d2722 100644 --- a/io.c +++ b/io.c @@ -2132,15 +2132,17 @@ rb_io_getc(VALUE io) rb_io_t *fptr; int r, n; VALUE str; + rb_encoding *enc; GetOpenFile(io, fptr); rb_io_check_readable(fptr); + enc = fptr->enc ? fptr->enc : rb_default_external_encoding(); READ_CHECK(fptr); if (io_fillbuf(fptr) < 0) { return Qnil; } - r = rb_enc_precise_mbclen(fptr->rbuf+fptr->rbuf_off, fptr->rbuf+fptr->rbuf_off+fptr->rbuf_len, fptr->enc); + r = rb_enc_precise_mbclen(fptr->rbuf+fptr->rbuf_off, fptr->rbuf+fptr->rbuf_off+fptr->rbuf_len, enc); if ((n = MBCLEN_CHARFOUND(r)) != 0 && n <= fptr->rbuf_len) { str = rb_str_new(fptr->rbuf+fptr->rbuf_off, n); fptr->rbuf_off += n; @@ -2154,7 +2156,7 @@ getc_needmore: rb_str_cat(str, fptr->rbuf+fptr->rbuf_off, 1); fptr->rbuf_off++; fptr->rbuf_len--; - r = rb_enc_precise_mbclen(RSTRING_PTR(str), RSTRING_PTR(str)+RSTRING_LEN(str), fptr->enc); + r = rb_enc_precise_mbclen(RSTRING_PTR(str), RSTRING_PTR(str)+RSTRING_LEN(str), enc); if (MBCLEN_NEEDMORE(r)) { goto getc_needmore; } diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index fd75d188bd..b613b7fa05 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -379,7 +379,7 @@ module Gem::Package end alias_method :is_directory, :is_directory? - alias_method :is_file, :is_file + alias_method :is_file, :is_file? def bytes_read @read diff --git a/lib/xsd/charset.rb b/lib/xsd/charset.rb index 15d5500fce..cd4d8a074c 100644 --- a/lib/xsd/charset.rb +++ b/lib/xsd/charset.rb @@ -10,7 +10,7 @@ module XSD module Charset - @internal_encoding = $KCODE + @internal_encoding = "ASCII" class XSDError < StandardError; end class CharsetError < XSDError; end