`scan': character encodings differ (ArgumentError)

e$B?\F#$G$9!#e(B

trunke$B$G$O!"e(Bencodinge$B$,e(BUS-ASCIIe$B$JJ8;zNs$re(Bkcodee$B$,e(B"utf8"[email protected],I=e(B
e$B8=$Ge(Bscane$B$7$h$&$H$9$k$He(BArgumentErrore$B$,H/@8$7$^$9!#e(B

% /tmp/local/bin/ruby -v -e ‘“x”.scan(/x/u)’
ruby 1.9.0 (2007-09-14 patchlevel 0) [x86_64-linux]
-e:1:in scan': character encodings differ (ArgumentError) from -e:1:in

e$B$3$l$O0l;~E*$J$b$N$J$N$G$7$g$&$+!)$=$l$H$b!"0U?^E*$JF0:n$J$Ne(B
e$B$G$7$g$&$+!)e(B

e$B$3$l$,860x$Ge(BREXMLe$B$O;H$$J*$K$J$i$J$/$J$C$F$$$^$9!#e(B

% /tmp/local/bin/ruby -v -r rexml/document -e
‘REXML::Document.new(%q())’
ruby 1.9.0 (2007-09-14 patchlevel 0) [x86_64-linux]
/tmp/local/lib/ruby/1.9/rexml/element.rb:707: warning: shadowing outer
local variable - child
/tmp/local/lib/ruby/1.9/rexml/element.rb:757: warning: shadowing outer
local variable - child
/tmp/local/lib/ruby/1.9/rexml/doctype.rb:121: warning: shadowing outer
local variable - child
/tmp/local/lib/ruby/1.9/rexml/xpath_parser.rb:296: warning: shadowing
outer local variable - node
/tmp/local/lib/ruby/1.9/rexml/xpath_parser.rb:355: warning: shadowing
outer local variable - node
/tmp/local/lib/ruby/1.9/rexml/xpath_parser.rb:367: warning: shadowing
outer local variable - node
/tmp/local/lib/ruby/1.9/rexml/parsers/xpathparser.rb:335: warning:
shadowing outer local variable - expr
/tmp/local/lib/ruby/1.9/rexml/parsers/treeparser.rb:90:in raise': #<REXML::ParseException: #<ArgumentError: character encodings differ> (REXML::ParseException) /tmp/local/lib/ruby/1.9/rexml/parsers/baseparser.rb:350:inscan’
/tmp/local/lib/ruby/1.9/rexml/parsers/baseparser.rb:350:in pull' /tmp/local/lib/ruby/1.9/rexml/parsers/treeparser.rb:21:inparse’
/tmp/local/lib/ruby/1.9/rexml/document.rb:233:in build' /tmp/local/lib/ruby/1.9/rexml/document.rb:42:ininitialize’
-e:1:in new' -e:1:in

Exception parsing
Line:
Position:
Last 80 unconsumed characters:

/tmp/local/lib/ruby/1.9/rexml/parsers/baseparser.rb:378:in raise' /tmp/local/lib/ruby/1.9/rexml/parsers/baseparser.rb:378:inrescue in
pull’
/tmp/local/lib/ruby/1.9/rexml/parsers/baseparser.rb:312:in pull' /tmp/local/lib/ruby/1.9/rexml/parsers/treeparser.rb:21:inparse’
/tmp/local/lib/ruby/1.9/rexml/document.rb:233:in build' /tmp/local/lib/ruby/1.9/rexml/document.rb:42:ininitialize’
-e:1:in new' -e:1:in

#<ArgumentError: character encodings differ>
/tmp/local/lib/ruby/1.9/rexml/parsers/baseparser.rb:350:in scan' /tmp/local/lib/ruby/1.9/rexml/parsers/baseparser.rb:350:inpull’
/tmp/local/lib/ruby/1.9/rexml/parsers/treeparser.rb:21:in parse' /tmp/local/lib/ruby/1.9/rexml/document.rb:233:inbuild’
/tmp/local/lib/ruby/1.9/rexml/document.rb:42:in initialize' -e:1:innew’
-e:1:in `’

Exception parsing
Line:
Position:
Last 80 unconsumed characters:

Line:
Position:
Last 80 unconsumed characters:
from /tmp/local/lib/ruby/1.9/rexml/parsers/treeparser.rb:90:in
rescue in parse' from /tmp/local/lib/ruby/1.9/rexml/parsers/treeparser.rb:19:inparse’
from /tmp/local/lib/ruby/1.9/rexml/document.rb:233:in build' from /tmp/local/lib/ruby/1.9/rexml/document.rb:42:ininitialize’
from -e:1:in new' from -e:1:in

REXMLe$B$N$3$N%(%i!<$N=P$7J}!J07$$J}!K$b$I$&$+$H$O;W$$$^$9$,!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:31781] `scan’: character encodings differ
(ArgumentError)”
on Sat, 15 Sep 2007 10:23:51 +0900, Kouhei S. [email protected]
writes:

|trunke$B$G$O!"e(Bencodinge$B$,e(BUS-ASCIIe$B$JJ8;zNs$re(Bkcodee$B$,e(B"utf8"[email protected],I=e(B
|e$B8=$Ge(Bscane$B$7$h$&$H$9$k$He(BArgumentErrore$B$,H/@8$7$^$9!#e(B
|
| % /tmp/local/bin/ruby -v -e ‘“x”.scan(/x/u)’
| ruby 1.9.0 (2007-09-14 patchlevel 0) [x86_64-linux]
| -e:1:in scan': character encodings differ (ArgumentError) | from -e:1:in
|
|e$B$3$l$O0l;~E*$J$b$N$J$N$G$7$g$&$+!)$=$l$H$b!"0U?^E*$JF0:n$J$Ne(B
|e$B$G$7$g$&$+!)e(B

[email protected]$5$s$+$i$b$"$j$^$7$?$,!">/$J$/$H$b;EMM$G$O$"$j$^$;$s!#e(B
e$B6a$$$&$A$KD>$7$^$9!#e(B

[email protected]$G$9!#e(B

At Sat, 15 Sep 2007 10:23:51 +0900,
Kouhei S. wrote in [ruby-dev:31781]:

trunke$B$G$O!"e(Bencodinge$B$,e(BUS-ASCIIe$B$JJ8;zNs$re(Bkcodee$B$,e(B"utf8"[email protected],I=e(B
e$B8=$Ge(Bscane$B$7$h$&$H$9$k$He(BArgumentErrore$B$,H/@8$7$^$9!#e(B

% /tmp/local/bin/ruby -v -e ‘“x”.scan(/x/u)’
ruby 1.9.0 (2007-09-14 patchlevel 0) [x86_64-linux]
-e:1:in scan': character encodings differ (ArgumentError) from -e:1:in

e$B$3$l$O0l;~E*$J$b$N$J$N$G$7$g$&$+!)$=$l$H$b!"0U?^E*$JF0:n$J$Ne(B
e$B$G$7$g$&$+!)e(B

[ruby-dev:31715]e$B$+$i$N%9%l%C%[email protected]$7$F$$$^$9$,!"[email protected]$O$^[email protected]$Ge(B
e$B$9!#e(B

e$B$H$j$"$($:!"<j85$G$O%(%i!<$K$J$i$J$$$N$O!">e5-$N%a!<%k$KE:IU$7$?e(B
e$B%Q%C%A$,1F6A$7$F$$$k$h$&$J5$$,$7$^$9!#e(B

e$B?\F#$G$9!#e(B

e$B$"$!!"e(BThe RWikie$B$K=q$/$h$&[email protected]$C$?$N$+$b!#!#!#e(B

In [email protected]
“[ruby-dev:31782] Re: `scan’: character encodings differ
(ArgumentError)” on Sat, 15 Sep 2007 11:23:47 +0900,
Nobuyoshi N. [email protected] wrote:

e$B$3$l$O0l;~E*$J$b$N$J$N$G$7$g$&$+!)$=$l$H$b!"0U?^E*$JF0:n$J$Ne(B
e$B$G$7$g$&$+!)e(B

[ruby-dev:31715]e$B$+$i$N%9%l%C%[email protected]$7$F$$$^$9$,!"[email protected]$O$^[email protected]$Ge(B
e$B$9!#e(B

e$B$"$^$jM}2r$G$-$F$$$J$$5$$,$9$k$N$G$9$,!"$=$N%9%l%C%I$O%j%F%ie(B
e$B%k$NJ8;zNs$N%(%s%3!<%G%#%s%[email protected]$H;W$C$F$$$^$7$?!#e(B

e$B$3$l$O!“0[$J$k%(%s%3!<%G%#%s%0$Ne(BStringe$B$He(BRegexpe$B$,$G$-$k$+!”[email protected](B
e$B$H;W$$$^$7$?!#;W$C$?$N$G$9$,!"$G$-$^$9$M!#e(B

e$B$H$$$&$+!"e(Bstring.c:scan_once()e$B$G$Oe(Brb_enc_check()e$B$G$O$J$/$F!"e(B
rb_enc_get(str)e$B$G==J,$J5$$,$7$^$9!#e(B

e$B$H$j$"$($:!"<j85$G$O%(%i!<$K$J$i$J$$$N$O!">e5-$N%a!<%k$KE:IU$7$?e(B
e$B%Q%C%A$,1F6A$7$F$$$k$h$&$J5$$,$7$^$9!#e(B

e$B$?$V$s!"e(Brb_enc_asciicompact()e$B$N$*$+$2$N$h$&$J5$$,$7$^$9!#e(B

e$B$^$D$b$H$5$s$,D>$7$F$/$l$k$H$$$&$3$H$J$N$G$b$&>/$7BT$D$3$H$Ke(B
e$B$7$^$9!#$"$j$,$H$&$4$6$$$^$7$?!#e(B

e$B?\F#$G$9!#e(B

In [email protected]
“[ruby-dev:31784] Re: `scan’: character encodings differ
(ArgumentError)” on Sat, 15 Sep 2007 12:03:38 +0900,
Kouhei S. [email protected] wrote:

e$B$3$l$O!“0[$J$k%(%s%3!<%G%#%s%0$Ne(BStringe$B$He(BRegexpe$B$,$G$-$k$+!”[email protected](B
e$B$H;W$$$^$7$?!#;W$C$?$N$G$9$,!"$G$-$^$9$M!#e(B

e$B$H$$$&$+!"e(Bstring.c:scan_once()e$B$G$Oe(Brb_enc_check()e$B$G$O$J$/$F!"e(B
rb_enc_get(str)e$B$G==J,$J5$$,$7$^$9!#e(B

sube$B$H$+$bF1$8M}M3$GF0$+$J$+$C$?$G$9!#e(B
e$B$H$j$"$($:!"<j85$G$O$3$s$JIw$K$7$Fe(BREXMLe$B$rF0$+$7$Fe(BRSS Parser
e$B$N%F%9%H$r$9$k$3$H$K$7$^$9!#e(B

Index: string.c

— string.c (e$B%j%S%8%g%se(B 13445)
+++ string.c (e$B:n6H%3%T!<e(B)
@@ -4448,7 +4448,7 @@
struct re_registers *regs;
long i;

  • enc = rb_enc_check(str, pat);
  • enc = rb_enc_get(str);
    if (rb_reg_search(pat, str, *start, 0) >= 0) {
    match = rb_backref_get();
    regs = RMATCH(match)->regs;
    Index: re.c
    ===================================================================
    — re.c (e$B%j%S%8%g%se(B 13445)
    +++ re.c (e$B:n6H%3%T!<e(B)
    @@ -2173,7 +2173,6 @@
    int no;
    rb_encoding *enc = rb_enc_check(str, src);
  • rb_enc_check(str, regexp);
    p = s = RSTRING_PTR(str);
    e = s + RSTRING_LEN(str);

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs