标签:android style blog http color io java ar for
在sdcard中创建接收文件名字时候,由于文件名编码的问题导致下面的错误。
01-01 08:10:11.054: W/dalvikvm(1824): JNI WARNING: illegal continuation byte 0xd2 01-01 08:10:11.054: W/dalvikvm(1824): string: ‘???.docx‘ 01-01 08:10:11.054: W/dalvikvm(1824): in Ljava/io/File;.listImpl (Ljava/lang/String;)[Ljava/lang/String; (NewStringUTF) 01-19 14:33:39.573: I/dalvikvm(566): "main" prio=5 tid=1 NATIVE 01-19 14:33:39.573: I/dalvikvm(566): | group="main" sCount=0 dsCount=0 obj=0x40997460 self=0x12810 01-19 14:33:39.573: I/dalvikvm(566): | sysTid=566 nice=0 sched=0/0 cgrp=default handle=1074082952 01-19 14:33:39.573: I/dalvikvm(566): | schedstat=( 334860174 892884911 75 ) utm=13 stm=20 core=0 01-19 14:33:39.573: I/dalvikvm(566): at java.io.File.listImpl(Native Method) 01-19 14:33:39.573: I/dalvikvm(566): at java.io.File.list(File.java:749) 01-19 14:33:39.573: I/dalvikvm(566): at java.io.File.listFiles(File.java:791)
在网上找了一个可能解决的办法,修改checkjni.c文件。但是感觉不是特别靠谱。具体没有尝试这种方法可不行不。通过搜索相关错误,我坚信应该是字符串编码问题导致。在参考这个贴子,完美解决了这个问题。这个帖子链接:https://groups.google.com/forum/#!topic/android-developers/y4lyEccZ--g
在帖子提供解决的方法:
Convert this string into UTF-8 first,then call NewStringUTF
eg:fileName=new String(fileName.getBytes(), "UTF-8");
Android JNI WARNING: illegal continuation byte 0xd2
标签:android style blog http color io java ar for
原文地址:http://www.cnblogs.com/chuji1988/p/3984882.html