在Unicode和默认语言环境之间转换 [英] Converting between Unicode and default locale

查看:80
本文介绍了在Unicode和默认语言环境之间转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


是否有便携式(至少用于VC.Net和g ++)方法转换文件



wchar_t和char,使用标准库?我可能已经错过了很多东西

很明显,但是在Josuttis''标准C ++

图书馆中的codecvt部分没有帮助,我是还在等待Langer的交付

标准C ++ IOStreams和Locales。


谢谢,

Keith MacDonald

[snip,直接回复之前]

Hello,

Is there a portable (at least for VC.Net and g++) method to convert text
between
wchar_t and char, using the standard library? I may have missed something
obvious, but the section on codecvt, in Josuttis'' "The Standard C++
Library", did not help, and I''m still awaiting delivery of Langer''s
"Standard C++ IOStreams and Locales".

Thanks,
Keith MacDonald
[snip, before replying directly]

推荐答案



" Keith MacDonald" <柯*** @ text-snip-pad.com>在消息中写道

news:bl ******************* @ news.demon.co.uk ...

"Keith MacDonald" <ke***@text-snip-pad.com> wrote in message
news:bl*******************@news.demon.co.uk...
你好,

是否有便携式(至少用于VC.Net和g ++)方法,使用标准库在
wchar_t和char之间转换文本?我可能已经错过了很明显的东西,但是在Josuttis''标准C ++
图书馆中关于codecvt的部分没有帮助,我还在等待Langer'的交付
标准C ++ IOStreams和Locales。
Hello,

Is there a portable (at least for VC.Net and g++) method to convert text
between
wchar_t and char, using the standard library? I may have missed something
obvious, but the section on codecvt, in Josuttis'' "The Standard C++
Library", did not help, and I''m still awaiting delivery of Langer''s
"Standard C++ IOStreams and Locales".




我在L& K的副本中读到没有内置支持
宽字符流
。类型''wchar_t''仅用于

来实现多字节流i / o。


另请注意,根据平台的字节大小,

并非所有Unicode值都必须符合类型

''char''。


-Mike



I read in my copy of L&K that there is no built-in support
for wide character streams. Type ''wchar_t'' is only used
to implement multibyte stream i/o.

Also note that depending upon your platform''s byte size,
not all Unicode values will necessarily fit into type
''char''.

-Mike




" Mike Wahler" < MK ****** @ mkwahler.net>在消息新闻中写道:好的***************** @ newsread3.news.pas.earthl ink.net ...

"Mike Wahler" <mk******@mkwahler.net> wrote in message news:ok*****************@newsread3.news.pas.earthl ink.net...
我在我的L& K副本中读到,对于宽字符流没有内置支持。类型''wchar_t''仅用于实现多字节流i / o。
I read in my copy of L&K that there is no built-in support
for wide character streams. Type ''wchar_t'' is only used
to implement multibyte stream i/o.




Mulstibyte使用多个字符来编码字符。

wchar_t是固定大小的宽字符。但我知道你的意思是什么。


是的,这是国际化支持的一个主要缺陷。

我有在comp.std.C ++游说修复此问题(将wchar_t

接口添加到极少缺乏它的几个地方

就像fstreams中的文件名等...) 。不幸的是,

我从

标准社区的其余部分得到了很多婊子和呻吟,他们没有认真对待

更有问题的字符编码如日语。



Mulstibyte is using more than one char to encode a character.
wchar_t is fixed size wide characters. But I knew what you
meant.

Yes, it''s a major defect in the internationalization support.
I have lobbied in comp.std.C++ to fix this (adding wchar_t
interfaces to the few places that are sorely lacking it
like the filenames in fstreams, etc...). Unfortunately,
I get a lot of bitching and moaning from rest of the
standard community who haven''t seriously dealt with
some of the more problematic character encodings such as Japanese.


在星期五,2003年9月26日21:21:38 +0100,Keith MacDonald写道:
On Fri, 26 Sep 2003 21:21:38 +0100, Keith MacDonald wrote:
你好,

是否有可移植的(至少用于VC.Net和g ++)方法来使用标准库在
wchar_t和char之间转换文本?我可能已经错过了很明显的东西,但是在Josuttis''标准C ++
图书馆中关于codecvt的部分没有帮助,我还在等待Langer'的交付
标准C ++ IOStreams和Locales。
Hello,

Is there a portable (at least for VC.Net and g++) method to convert text
between
wchar_t and char, using the standard library? I may have missed something
obvious, but the section on codecvt, in Josuttis'' "The Standard C++
Library", did not help, and I''m still awaiting delivery of Langer''s
"Standard C++ IOStreams and Locales".




尝试mbstowcs / wcstombs。

-

Aaron Isotton
http://www.isotton.com/



Try mbstowcs/wcstombs.
--
Aaron Isotton
http://www.isotton.com/


这篇关于在Unicode和默认语言环境之间转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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