android ::JNI WARNING illegal start byte0xxx
来源:互联网 发布:php 判断在微信浏览器 编辑:程序博客网 时间:2024/06/03 18:37
blog.csdn.net/livingpark
导致这一错误是android中chechjni.c里面的函数static void checkUtfString(JNIEnv* env, const char* bytes, bool nullOk,
const char* func)对字符串进行检查,不符合它的标准就回出错。
解决方法是使用字符串之前进行转换,使字符串符合要求,以下函数是一种方案,根据checkUtfString函数改写。
int char2UTF(char* cp)
{
char* bytes;
bytes = cp;
while (*bytes != '/0')
{
unsigned char utf8 = *(bytes++);
// Switch on the high four bits.
switch (utf8 >> 4) {
case 0x00:
case 0x01:
case 0x02:
case 0x03:
case 0x04:
case 0x05:
case 0x06:
case 0x07: {
// Bit pattern 0xxx. No need for any extra bytes.
break;
}
case 0x08:
case 0x09:
case 0x0a:
case 0x0b:
case 0x0f: {
/*
* Bit pattern 10xx or 1111, which are illegal start bytes.
* Note: 1111 is valid for normal UTF-8, but not the
* modified UTF-8 used here.
*/
LOGW("JNI WARNING: illegal start byte 0x%x/n", utf8);
*((unsigned char *)(bytes-1)) = 0x3f;
break;
}
case 0x0e: {
// Bit pattern 1110, so there are two additional bytes.
utf8 = *(bytes++);
if ((utf8 & 0xc0) != 0x80) {
LOGW("JNI WARNING: illegal continuation byte 0x%x/n", utf8);
*((unsigned char *)(bytes-1)) = 0x80;
}
// Fall through to take care of the final byte.
}
case 0x0c:
case 0x0d: {
// Bit pattern 110x, so there is one additional byte.
utf8 = *(bytes++);
if ((utf8 & 0xc0) != 0x80) {
LOGW("JNI WARNING: illegal continuation byte 0x%x/n", utf8);
*((unsigned char *)(bytes-1)) = 0x80;
}
break;
}
}
}
return 0;
}
- android ::JNI WARNING illegal start byte0xxx
- Android: JNI WARNING: illegal start byte
- JNI WARNING: illegal start byte
- Android NDK JNI WARNING: illegal start byte 0x
- 关于:JNI WARNING: illegal start byte 处理
- 关于:JNI WARNING: illegal start byte 处理
- JNI WARNING: input is not valid Modified UTF-8: illegal start byte 0xfe
- mFile.listFiles() JNI WARNING: input is not valid Modified UTF-8: illegal start byte 0xb7
- JNI WARNING: NewStringUTF input is not valid Modified UTF-8: illegal start byte 0xf5
- JNI WARNING: NewStringUTF input is not valid Modified UTF-8: illegal start byte 0xb0
- JNI WARNING: illegal class name 'Ljava/lang/String;' (FindClass)
- Illegal string offset Warning PHP
- Warning: Illegal offset type错误
- jni 中使用NewStringUTF时报错:input is not valid Modified UTF-8: illegal start byte 0xa0
- android jni问题之JNI WARNING: threadid=1 using JNI after critical get (GetObjectClass)
- Warning: Illegal string offset 'account' in 解决方法
- Android之JNI DETECTED ERROR IN APPLICATION: illegal class name 'XXX'的错误解决方法
- jni 中使用NewStringUTF时报错:input is not valid Modified UTF-8: illegal start byte 0xa0(十六进制未定义字符)
- tomcat6报错——java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
- 利用Menu和MultiView做一个菜单导航
- jquery 固定和滚动表格
- 深入分析Flex [Bindable] 以及使用方法
- CString,Char*,string 互相转换(转)
- android ::JNI WARNING illegal start byte0xxx
- C#检查网络是否连接的方法
- winsocket的IO模型
- const用法总结
- javax.mail.AuthenticationFailedException异常的处理
- NSF Workshop on Hybrid Neuro-Computer Vision Systems
- js 无插件选项卡 支持自动改变选中项
- JAVA程序编写风格
- Visual Studio 2008 Hot Keys