diff --git a/ChangeLog b/ChangeLog index 5cf4489cdb..10f711de39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jun 21 10:46:32 2009 Nobuyoshi Nakada + + * transcode.c (enc_arg): default interanl encoding may not be set. + [ruby-core:23932] + Sat Jun 20 21:11:43 2009 Tadayoshi Funaba * numeric.c (num_div): don't use num_floor which is actually diff --git a/transcode.c b/transcode.c index 7fb25601fc..ee6794d9be 100644 --- a/transcode.c +++ b/transcode.c @@ -2470,13 +2470,13 @@ enc_arg(volatile VALUE *arg, const char **name_p, rb_encoding **enc_p) int encidx; VALUE encval; - if ((encidx = rb_to_encoding_index(encval = *arg)) < 0) { + if (((encidx = rb_to_encoding_index(encval = *arg)) < 0) || + !(enc = rb_enc_from_index(encidx))) { enc = NULL; encidx = 0; n = StringValueCStr(*arg); } else { - enc = rb_enc_from_index(encidx); n = rb_enc_name(enc); }