Wilson Bilkovich
12/13/2005 7:20:00 PM
On 12/13/05, Dave Burt <dave@burt.id.au> wrote:
>
> The first problem here is ENOENT. That's C's "not found", presumably
> referring to the character set "X-UNKNOWN" (not any "file or directory").
> I'm told [1], this can occur because the config.charset aliases are not
> available. But, actually, I can't find x-unknown in the aliases file, and
> don't know enough about iconv to know if it should be handling it as an
> intrinsic type.
>
> For x-unknown, maybe try substituting "char" or the empty string ""; this
> means the locale-dependant default encoding (so isn't the same as
> x-unknown).
>
When I switch 'X-UNKNOWN' to 'char' in the test fixture, everything works fine.
Specifically, the code that freaks out is:
def convert_to(text, to, from)
return text unless to && from
text ? Iconv.iconv(to, from, text).first : ""
rescue Iconv::IllegalSequence, Errno::EINVAL
# the 'from' parameter specifies a charset other than what the text
# actually is...not much we can do in this case but just return the
# unconverted text.
#
# Ditto if either parameter represents an unknown charset, like
# X-UNKNOWN.
text
end
Given that, it looks like you're right about the library not setting
the proper error environment, because the method that invokes it is
expecting it to throw an error.
Oddly, though, ENOENT isn't on the list of exceptions to rescue there.
Adding it to the list doesn't stop the crash bug, unfortunately.
I tried putting config.charset in both c:/windows/system32, and in
c:/ruby/lib/ruby/1.8/i386-mswin32 (where iconv.so goes), to no avail.