input is not valid Modified UTF-8: illegal start byte 0x**
2013-10-25 13:52
1571 查看
扫描一个视频时,视频的文件信息中,标题是乱码,导致表面上的重启,具体出错信息为:
最后通过utf8字符判断修正该问题,文件位置frameworks\base\media\jni\android_media_MediaMetadataRetriever.cpp
增加函数IsUTF8,然后在android_media_MediaMetadataRetriever_extractMetadata方法中做出判断,当不为utf-8时返回null
编译libmedia_jni,之后push进system/lib,删除/data/data/com.android.providers.media文件夹,重启手机即可修正问题。
转自: http://www.xdty.org/1370
W/dalvikvm(17090): JNI WARNING: input is not valid Modified UTF-8: illegal start byte 0xb3 W/dalvikvm(17090): string: '³ÇÊÐÁÔÈË01' W/dalvikvm(17090): in Landroid/media/MediaMetadataRetriever;.extractMetadata:(I)Ljava/lang/String; (NewStringUTF)
最后通过utf8字符判断修正该问题,文件位置frameworks\base\media\jni\android_media_MediaMetadataRetriever.cpp
增加函数IsUTF8,然后在android_media_MediaMetadataRetriever_extractMetadata方法中做出判断,当不为utf-8时返回null
bool IsUTF8(const void* pBuffer, long size) { bool IsUTF8 = true; unsigned char* start = (unsigned char*)pBuffer; unsigned char* end = (unsigned char*)pBuffer + size; while (start < end) { if (*start < 0x80) // (10000000): value less then 0x80 ASCII char { start++; } else if (*start < (0xC0)) // (11000000): between 0x80 and 0xC0 UTF-8 char { IsUTF8 = false; break; } else if (*start < (0xE0)) // (11100000): 2 bytes UTF-8 char { if (start >= end - 1) break; if ((start[1] & (0xC0)) != 0x80) { IsUTF8 = false; break; } start += 2; } else if (*start < (0xF0)) // (11110000): 3 bytes UTF-8 char { if (start >= end - 2) break; if ((start[1] & (0xC0)) != 0x80 || (start[2] & (0xC0)) != 0x80) { IsUTF8 = false; break; } start += 3; } else { IsUTF8 = false; break; } } return IsUTF8; } static jobject android_media_MediaMetadataRetriever_extractMetadata(JNIEnv *env, jobject thiz, jint keyCode) { ALOGV("extractMetadata"); MediaMetadataRetriever* retriever = getRetriever(env, thiz); if (retriever == 0) { jniThrowException(env, "java/lang/IllegalStateException", "No retriever available"); return NULL; } const char* value = retriever->extractMetadata(keyCode); if (!value) { ALOGV("extractMetadata: Metadata is not found"); return NULL; } ALOGV("extractMetadata: value (%s) for keyCode(%d)", value, keyCode); if (!IsUTF8(value,strlen(value))) { return NULL; } return env->NewStringUTF(value); }
编译libmedia_jni,之后push进system/lib,删除/data/data/com.android.providers.media文件夹,重启手机即可修正问题。
转自: http://www.xdty.org/1370
相关文章推荐
- JNI WARNING: NewStringUTF input is not valid Modified UTF-8: illegal start byte 0xb0
- jni 中使用NewStringUTF时报错:input is not valid Modified UTF-8: illegal start byte 0xa0
- JNI WARNING: NewStringUTF input is not valid Modified UTF-8: illegal start byte 0xf5
- jni 中使用NewStringUTF时报错:input is not valid Modified UTF-8: illegal start byte 0xa0(十六进制未定义字符)
- JNI WARNING: input is not valid Modified UTF-8: illegal start byte 0xfe
- crash - JNI WARNING: input is not valid modified utf-8: illegal continuation byte
- JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal continuation byte 0x12
- JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal continuation byte 0x3f
- JNI WARNING: input is not valid Modified UTF-8
- 关于调用listFile()在遍历含有乱码文件时出现input is not valid Modified UTF-8错误的解决方法
- newStringUTF出现input is not valid Modified UTF-8错误解决办法
- SOAP-ERROR: Encoding: string … is not a valid utf-8 string
- The input stream is not a valid binary format
- java.lang.IllegalStateException:Make sure the content of your adapter is not modified from a backgro
- "Cant start Git: git.exe probably the path to Git executable is not valid" Fix it." error
- Unable to start activity ComponentInfo: Resource ID is not valid
- 【opencl】buildprogram错误日志提示source file is not valid utf-8
- 错误记录:Resource ID #0x7f040006 type #0x12 is not valid
- The input character is not valid in MATLAB statements or expressions.
- android.content.res.Resources$NotFoundException:Resource ID #0x7f080004 type #0x12 is not valid问题解决