[DllImport ( "KERNEL32.DLL", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] private static extern int WideCharToMultiByte (uint CodePage, uint dwFlags, string lpWideCharStr, int cchWideChar, string lpMultiByteStr , Int cchmultibyte, string lpdefaultchar, int lpuseddefaultchar);
Private const uint cp_acp = 0x0;
Public void iShaveChinese () {string m_str = "ABC Speech"; int Nlen = WideChartomultibyte (CP_ACP, 0, M_STR, M_STR.LENGTH, NULL, 0, NULL, 0); if (m_str.length! = nlen) {MessageBox .Show ("there is Chinese characters.");} Else {messagebox.show ("There is no Chinese characters.");}}