怎样让gettext返回的是wchar_t*字符串? Topic is solved

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
Loaden
I live to help wx-kind
I live to help wx-kind
Posts: 177
Joined: Tue Feb 19, 2008 10:21 am
Location: China

怎样让gettext返回的是wchar_t*字符串?

Post by Loaden » Sat Dec 27, 2008 2:57 am

我在做一个工程:wxWidgets写界面(用DLL),其他功能全是WinSDK完成。
这样的话,我只能自己封装gettext函数,但这个函数返回的是char*。
定义:#define _(s) gettext(s)
如何解决?请问有gettext的C++封装类吗?
Life is not fair, get used to it.

Loaden
I live to help wx-kind
I live to help wx-kind
Posts: 177
Joined: Tue Feb 19, 2008 10:21 am
Location: China

Re: 怎样让gettext返回的是wchar_t*字符串?

Post by Loaden » Sat Dec 27, 2008 9:17 am

Loaden wrote:我在做一个工程:wxWidgets写界面(用DLL),其他功能全是WinSDK完成。
这样的话,我只能自己封装gettext函数,但这个函数返回的是char*。
定义:#define _(s) gettext(s)
如何解决?请问有gettext的C++封装类吗?
我的意思是不用我自己写转换函数,gettext是否支持输出wchar_t字符?
Life is not fair, get used to it.

Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil » Mon Dec 29, 2008 12:44 am

个人(没有经过调查)的理解是:

gettext返回的是utf-8,因此char*会比wchar*更为合适。

-Utensil
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/

Loaden
I live to help wx-kind
I live to help wx-kind
Posts: 177
Joined: Tue Feb 19, 2008 10:21 am
Location: China

Post by Loaden » Thu Jan 01, 2009 9:24 am

原来是UTF-8编码:那还是需要向Unicode转换才可以啊。即:utf-8->unicode ?
Life is not fair, get used to it.

Post Reply