Hi,

At Tue, 16 Oct 2007 19:40:22 +0900,
murphy wrote in [ruby-core:12700]:
> works for me. great! it uses Oniguruma's encoding functions, right?

Yes.

> however, I get a strange output for this:
> 
>   'ÿ'.upcase  # => "Ÿ¿"
>   'ÿ'.upcase.unpack('H*')  # => ["c5b8bf00"]

utf8_code_to_mbclen() seems returning invalid result for 0xff
and 0xfe.  I suspect it may be related to BOM but am not sure.

It would work by changing in CHANGECASE() from

+	if (n > 0) len += n;				\
+	s += rb_enc_codelen(c, enc);			\

to

+	if (n <= 0)					\
+	    rb_raise(rb_eArgError,			\
+		     "invalid mbstring sequence");	\
+	len += n;					\
+	s += n;						\

-- 
Nobu Nakada