之前帮人家解决乱码问题时回过一个帖子 现在总结在博客里 留起来 bool handleString(char* name) { jstring rtnname = 0; int slenname = strlen(name); unsigned short * namebuffer = 0; if( slenname == 0 ) rtnname = mEnv->NewStringUTF(name); else { wchar_t* wname = NULL; setlocale(LC_ALL,""); int namelength=mbstowcs(wname,name,strlen(name)*2); namebuffer = (unsigned short *)malloc(namelength*2 + 1 ); if((rtnname = mEnv->NewString( (jchar*)namebuffer, namelength )) == NULL) return false; if( namebuffer ) free(namebuffer ); } return true; } bool isASCII(const char* chp) { char ch; bool flag; while ((ch = *chp++)) { flag = false; if (ch & 0x80) { flag = true; break; } } return flag; } 有朋友反映找不到mbstowcs #include <locale.h>#include <stdlib.h> 就可以找到了