Modified: MacRuby/trunk/parse.y (3765 => 3766)
--- MacRuby/trunk/parse.y 2010-03-15 22:01:12 UTC (rev 3765)
+++ MacRuby/trunk/parse.y 2010-03-16 02:03:57 UTC (rev 3766)
@@ -5508,13 +5508,20 @@
}
}
+#include <unicode/utf8.h>
+
static void
parser_tokaddmbc(struct parser_params *parser, int c, rb_encoding *enc)
{
#if WITH_OBJC
- /* FIXME */
- char *buf = tokspace(1);
- *(buf) = c;
+ const int bytelen = U8_LENGTH(c);
+ uint8_t *buf = (uint8_t *)tokspace(bytelen);
+ UBool error = false;
+ int offset = 0;
+ U8_APPEND(buf, offset, bytelen, c, error);
+ if (error) {
+ rb_raise(rb_eArgError, "invalid unicode point U+%d", c);
+ }
#else
int len = rb_enc_codelen(c, enc);
rb_enc_mbcput(c, tokspace(len), enc);