From 7ab48f03e90ed3859ad4e49166bbfd31707e5c91 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 24 Sep 2007 08:56:24 +0000 Subject: [PATCH] * ext/strscan/strscan.c (strscan_initialize, strscan_getch): use the encoding of the target string instead of setting to StringScanner instance. [ruby-dev:31831] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ ext/strscan/strscan.c | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd7bf9c06c..057f5c5df2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Sep 24 17:56:21 2007 Nobuyoshi Nakada + + * ext/strscan/strscan.c (strscan_initialize, strscan_getch): use the + encoding of the target string instead of setting to StringScanner + instance. [ruby-dev:31831] + Mon Sep 24 16:52:11 2007 Urabe Shyouhei * lib/net/http.rb: fix typo. diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index ac07b39789..fc4a7cf4e1 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -190,7 +190,6 @@ strscan_initialize(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "11", &str, &need_dup); StringValue(str); p->str = str; - rb_enc_associate(self, rb_enc_get(str)); return self; } @@ -654,14 +653,13 @@ strscan_getch(VALUE self) { struct strscanner *p; long len; - rb_encoding *enc = rb_enc_get(self); GET_SCANNER(self, p); CLEAR_MATCH_STATUS(p); if (EOS_P(p)) return Qnil; - len = rb_enc_mbclen(CURPTR(p), S_PEND(p), enc); + len = rb_enc_mbclen(CURPTR(p), S_PEND(p), rb_enc_get(p->str)); if (p->curr + len > S_LEN(p)) { len = S_LEN(p) - p->curr; }