From: Park Heesob Date: 2002-08-28T13:43:16+09:00 Subject: Re: c-api: rb_str_new Hi, "Matthias Veit" wrote in message news:20020828021424.20f202ee.matthias_veit@yahoo.de... > > Hello, > > I have trouble using rb_str_new[2] and German umlauts. > The umlauts will be escaped: > > c program: > static VALUE test(VALUE self, VALUE word) { > char *str = STR2CSTR(word); > printf("got: %s\n", str); > return rb_str_new2(str); > } > > from ruby: > p foo.test("F�lschung") > > will print: > got: F�lschung > "F\344lschung" > > Both worlds (c and ruby) handle the string correctly, but > the translation fails. > Do I have to adjust the encoding? Some idea? > > Best regards, > Matthias Try this: $KCODE = 'n' p "F\344lschung" $KCODE = 'u' p "F\344lschung" Park Heesob