JNI中文处理问题小结[9]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

                                wcslen (w_buffer)); // Deep Copy, in usual case we only need Shallow Copy as we just need this class to provide some convenience for handling jstring

        mChars = new char[wcslen (w_buffer) * 2 + 1];
        WideCharToMultiByte (CP_ACP, 0, w_buffer, wcslen (w_buffer) + 1, mChars, wcslen (w_buffer) * 2 + 1,
                             NULL,   NULL);
        env->ReleaseStringChars (str, w_buffer);

        mString = mChars;
    }


    // Create a new instance from the specified string
    JNIString(JNIEnv* env, const string& str) :
        mEnv (env) {
        int
 slen = str.length ();
        jchar* buffer = new jchar[slen];
        int
 len = MultiByteToWideChar (CP_ACP, 0, str.c_str (), str.length (), buffer, slen);

本文关键:JNI中文处理问题小结
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top