Iconv::IllegalSequence#failed

Iconv::IllegalSequence#failed e$B$,<:GT$7$?>l=j$+$i$Ne(B String e$B$re(B
e$BJV$5$J$$$3$H$,$"$j$^$9!#e(B

% ./ruby -riconv -e 'ic = Iconv.new(“euc-jp”, “euc-jp”);
s = “\xa4\xa2\xa4\xa4\x8fabc”.force_encoding(“euc-jp”)
p s
begin
ic.iconv(s)
rescue Iconv::IllegalSequence
p $!.success
p $!.failed
end

“e$B$”$$e(B\x8Fabc"
“\xA4\xA2\xA4\xA4”
“bc”

(success e$B$,e(B EUC-JP e$B$K$J$C$F$J$$$N$Oe(B [ruby-dev:33221]
e$B$G=q$$e(B
e$B$?$N$G$$$$F$$/$H$7$Fe(B) e$B$3$N>l9ge(B \x8F
e$B$G<:GT$7$F$$$k$N$G!“e(B
failed e$B$Oe(B “\x8Fabc” e$B$K$J$C$F$[$7$$$H$3$m$G$9$,!“e(B”\x8Fa”
e$B$,H4e(B
e$B$1$F!“e(B"bc” [email protected]$1$,JV$C$F$-$^$9!#e(B

e$B$^$?!"0J2<$N$h$&$K$9$k$H!"e(Bfailed e$B$,e(B nil e$B$rJV$7$^$9!#e(B

% ./ruby -riconv -e 'ic = Iconv.new(“euc-jp”, “euc-jp”);
s =
“\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa\x8fabc”.force_encoding(“euc-jp”)
p s
begin
ic.iconv(s)
rescue Iconv::IllegalSequence
p $!.success
p $!.failed
end

“e$B$”$$$&$($*e(B\x8Fabc"
“\xA4\xA2\xA4\xA4\xA4\xA6\xA4\xA8\xA4\xAA”
nil

e$B?dB,$H$7$F$O!"%P%$%HC10L$HJ8;zC10L$r<h$j0c$($F$k$h$&$Je(B?

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