I suppose you were right. I changed the encoding the the string and it seems to be correct now. No more segfaults. Thanks!
On Dec 16, 8:42 pm, ip332 <[email protected]> wrote: > There is nothing strange. > You have a C string, something like that: > char* fileName = "Dracula Der Pfähler.mp3" > When you typed this text it was converted into 8-bit code (single > byte, ISO encoding). > So there is nothing strange that NewStringUTF() complains about > "illegal continuation byte" because fileName is not UTF8 encoded > string. > You need convert this string into UTF8 (aka "multibyte") first, then > call NewStringUTF(). > > On Dec 16, 9:46 am, Luca Carlon <[email protected]> wrote: > > > Hi! I'm trying to create a jstring using NewStringUTF but I > > experienced a strange issue when the C string passed to the function > > contains characters not ASCII (i.e. accented characters). This is what > > I get: > > > 01-01 02:56:41.719: WARN/(1738): Creating the jstring for Dracula Der > > Pfähler.mp3. > > 01-01 02:56:41.719: WARN/dalvikvm(1738): JNI WARNING: illegal > > continuation byte 0x68 > > 01-01 02:56:41.719: WARN/dalvikvm(1738): string: 'Dracula > > Der Pfähler.mp3' > > 01-01 02:56:41.719: WARN/dalvikvm(1738): in <method_name> > > (NewStringUTF) > > > where the first line is created using the char* and the android log > > functions. This is the piece of code: > > > jstring pathStr; > > LOGW("Creating the jstring for %s.", fileName); > > if ((pathStr = mEnv->NewStringUTF(fileName)) == NULL) { > > LOGE("Failed NewStringUTF."); > > return false;} > > > LOGW("The jstring has been created..."); > > > Any idea why this is happening? > > Thanks! > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

