C ++ 0x是否有本地化支持的更新? [英] Are there any updates of localization support in C++0x?

查看:284
本文介绍了C ++ 0x是否有本地化支持的更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




  • std :: time_get
    - 不与 std :: time_put (因为它在C strftime / strptime)对称,不允许轻松解析

  • 发现最近,简单的数字格式可能会产生非法的UTF-8在某些区域(如 ru_RU.UTF-8 )。

  • std :: ctype 是非常简单的,假设可以对每个字符基址进行上/下限(大小写转换可能会改变字符数,上下文相关)。

  • std :: collat​​e - 不支持排序规则(区分大小写或不区分大小写)。

  • 无法在时间格式中指定与全球时区不同的时区。






  • 是否有人知道在C ++ 0x的标准构面中是否有任何改变?

  • 是否有任何方法能够重视此类更改?



感谢。



EDIT:如果链接无法访问,请说明:



std :: numpunct 将千位分隔符定义为char。因此,当U + 2002中的分隔符不同类型的空间时,它不能作为UTF-8中的单个字符再现为多个字节序列。



在C API struct lconv 将千位分隔符定义为字符串,不会遇到此问题。因此,当您尝试使用UTF-8语言环境的ASCII之外的分隔符格式化数字时,将生成无效的UTF-8。



要重现此错误,请将1234写入std: ostream with imbued ru_RU.UTF-8 locale



EDIT2:我必须承认POSIX C本地化API工作得更顺畅:




  • 有strftime的逆 - strptime(strftime和 std :: time_put :: put

  • 由于我上面提到的点,数字格式没有问题。



EDIT3:根据最新的注意事项C ++ 0x我可以看到 std :: time_get :: get - 类似于 strptime code> std :: time_put :: put 。

解决方案

C ++没有正确的i18n支持。


有人知道在C ++ 0x的标准面中是否有任何改变?


在游戏中太晚了,所以可能不会。


有什么方法可以重视这些变化吗?


我非常悲观。

b
$ b

当直接询问时,Stroustrup声称他没有看到当前状态的任何问题。另一个大的C ++家伙(书作者和所有)甚至没有意识到,如果你阅读标准,wchar_t可以是一个字节。



有些线程boost(这似乎驱动未来的方向)显示这么少的理解,如何这是完全可怕的工作。



C ++ 0x几乎不添加一些Unicode字符数据类型,后期的游戏和后很多的斗争。



我想只有机会看到更好的东西是,如果有人在i18n和C ++世界中真的很好/尊重得到直接涉及下一版本的标准。没有线索可能是: - (


The more I work with C++ locale facets, more I understand --- they are broken.

  • std::time_get -- is not symmetric with std::time_put (as it in C strftime/strptime) and does not allow easy parsing of times with AM/PM marks.
  • I discovered recently that simple number formatting may produce illegal UTF-8 under certain locales (like ru_RU.UTF-8).
  • std::ctype is very simplistic assuming that to upper/to lower can be done on per-character base (case conversion may change number of characters and it is context dependent).
  • std::collate -- does not support collation strength (case sensitive or insensitive).
  • There is not way to specify timezone different from global timezone in time formatting.

And much more...

  • Does anybody knows whether any changes are expected in standard facets in C++0x?
  • Is there any way to bring an importance of such changes?

Thanks.

EDIT: Clarifications in case the link is not accessible:

std::numpunct defines thousands separator as char. So when separator in U+2002 -- different kind of space it can't be reproduced as single char in UTF-8 but as multiple byte sequence.

In C API struct lconv defines thousands separator as string and does not suffers from this problem. So, when you try to format numbers with separators outside of ASCII with UTF-8 locale, invalid UTF-8 is produced.

To reproduce this bug write 1234 to std:ostream with imbued ru_RU.UTF-8 locale

EDIT2: I must admit that POSIX C localization API works much smoother:

  • There is inverse of strftime -- strptime (strftime does same as std::time_put::put)
  • No problems with number formatting because of the point I mentioned above.

However it is still for from being perfecet.

EDIT3: According to the latest notes about C++0x I can see that std::time_get::get -- similar to strptime and opposite of std::time_put::put.

解决方案

I agree with you, C++ is lacking proper i18n support.

Does anybody knows whether any changes are expected in standard facets in C++0x?

It is too late in the game, so probably not.

Is there any way to bring an importance of such changes?

I am very pessimistic about this.

When asked directly, Stroustrup claimed that he does not see any problems with the current status. And another one of the big C++ guys (book author and all) did not even realize that wchar_t can be one byte, if you read the standard.

And some threads in boost (which seems to drive the direction in the future) show so little understanding on how this works that is outright scary.

C++0x barely added some Unicode character data types, late in the game and after a lot of struggle. I am not holding my breath for more too soon.

I guess the only chance to see something better is if someone really good/respected in the i18n and C++ worlds gets directly involved with the next version of the standard. No clue who that might be though :-(

这篇关于C ++ 0x是否有本地化支持的更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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