我不能在ma MFC项目中写波斯语 [英] I cant write Persian language in ma MFC project

查看:76
本文介绍了我不能在ma MFC项目中写波斯语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我写了一个VC ++项目。在程序界面的设计模式中,我在字幕字段中编写波斯语并运行项目,但在运行模式下,文本显示为??????



我该如何解决?

Hi
I have wrote a VC++ project . in design mode for interface of program , I write Persian in caption field and I run the project , But in run mode the Texts is shown " ?????? "

How can I fix it?

推荐答案

听说过Unicode及其工作原理吗?

请参阅:

http://en.wikipedia.org/wiki / Unicode [ ^ ],

http://unicode.org/ [ ^ ]。



Unicode不是编码。您需要知道的一件事是在Windows上,Unicode文本的内存表示是UTF-16LE。请参阅:

http://www.unicode.org/faq/utf_bom.html [ ^ ]。



关于Unicode和C ++:

http:// www.i18nguy.com/unicode/c-unicode.html [ ^ ],

http://msdn.microsoft.com/en-us/library/1by39td3%28v=vs.110%29.aspx [ ^ ]。


$ b带有MFC的$ b Unicode: http://msdn.microsoft.com/ en-us / library / wsdfs47e%28v = vs.110%29.aspx [ ^ ]。



-SA
Ever heard of Unicode and how it works?
Please see:
http://en.wikipedia.org/wiki/Unicode[^],
http://unicode.org/[^].

Unicode is not encoding. One thing you need to know is that on Windows memory representation of Unicode text is UTF-16LE. Please see:
http://www.unicode.org/faq/utf_bom.html[^].

About Unicode and C++:
http://www.i18nguy.com/unicode/c-unicode.html[^],
http://msdn.microsoft.com/en-us/library/1by39td3%28v=vs.110%29.aspx[^].

Unicode with MFC: http://msdn.microsoft.com/en-us/library/wsdfs47e%28v=vs.110%29.aspx[^].

—SA


您好。



添加这两个简单的功能并使用它。



void MakeUnicodeString(CStringW& cstrW,const char * multibyte)

{

int nbytes = MultiByteToWideChar(CP_ACP,0,multibyte) ,-1,0,0);

WCHAR * wstr =新WCHAR [nbytes + 2];

MultiByteToWideChar(CP_ACP,0,multibyte,-1,wstr, nbytes);

wstr [nbytes] = 0;

cstrW = wstr;

delete [] wstr;

}



void MakeAnsiString(CString& cstr,const WCHAR * wide)

{

int nbytes = WideCharToMultiByte(CP_ACP,0,宽,-1,0,0,0,0);

char * str = new char [nbytes + 2];

WideCharToMultiByte (CP_ACP,0,宽,-1,str,nbytes,0,0);

str [nbytes] = 0;

cstr = str;

删除[] str;

}



如果您对谷歌++或博客有任何疑问,请写信给我:

http:// strongcpp .blogspot.ru / [ ^ ]


这篇关于我不能在ma MFC项目中写波斯语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆