草庐IT

东亚语

全部标签

PHP NumberFormatter 斯洛文尼亚语拼写错误

我尝试使用intl包中的NumberFormatter类将整数拼写成斯洛文尼亚语单词(用于邮政申报),但结果完全错误且毫无意义。$fmt=newNumberFormatter('sl',NumberFormatter::SPELLOUT);$fmt->format(561);结果是“petstošestdesetena”,而它应该是“petstoenainšestdeset”。看起来像儿戏。在非常相似的克罗地亚语中,结果似乎还不错(“petstošezdesetijedan”)。这是PHP翻译做得不好还是基于我的系统区域设置?我在PHP5.3.10/Ubuntu12.04上。编辑:in

python - 如何控制包含东亚字符的 Unicode 字符串的填充

我得到了三个UTF-8字符串:hello,worldhello,世界hello,世rld我只想要前10个ascii-char-width,这样一列中的括号:[hello,wor][hello,世][hello,世r]在控制台中:width('世界')==width('worl')width('世')==width('wor')#awhitespacebehind'世'一个汉字是三个字节,但在控制台显示时只有2个ascii字符的宽度:>>>bytes("hello,世界",encoding='utf-8')b'hello,\xe4\xb8\x96\xe7\x95\x8c'当UTF-8字符
12