which database should I use, if my application is going to be in multiple languages (including Chinese, Japanese etc)? In other words, is MySQL better or worse than Postgres to handle unicode etc? (these are the only two databases my hosting company has)
如果我的应用程序将使用多种语言(包括中文,日文等),我应该使用哪个数据库?换句话说,MySQL是否比Postgres更好或更差来处理unicode等? (这是我托管公司唯一的两个数据库)
Also, which language is better for handling unicode? PHP or Ruby/Rails?
另外,哪种语言更适合处理unicode? PHP或Ruby / Rails?
4 个解决方案
#1
7
Mysql does not have full support for Unicode (eg: Chinese characters outside the BMP) (see). It uses a crippled 'utf8' encoding (not really UTF-8).
Mysql没有完全支持Unicode(例如:BMP之外的中文字符)(参见参考资料)。它使用了残缺的'utf8'编码(不是真正的UTF-8)。
Postgresql seems to have full support for UTF-8 encoding (hence, for all Unicode characters).
Postgresql似乎完全支持UTF-8编码(因此,对于所有Unicode字符)。
#2
1
Databases:
In my experience, both MySQL and Postgres handled Unicode quite okay.
根据我的经验,MySQL和Postgres都处理Unicode非常好。
Languages:
- PHP <=5.3 is somewhat restricted in regard to unicode, while the upcoming PHP 6 promises to fix that.
- Ruby 1.8 had poor unicode support, but 1.9 is said to handle unicode nicely (I have no own experience there).
PHP <= 5.3在unicode方面有所限制,而即将推出的PHP 6有望解决这个问题。
Ruby 1.8的unicode支持很差,但据说1.9可以很好地处理unicode(我没有自己的经验)。
Restrictions of PHP 5.3:
PHP 5.3的限制:
It is possible to use PHP 5 together with unicode, but then one has to be careful with strings. Many string functions, for instance the one which counts the length of characters, returns the number of bytes, not the number of characters. There are are additional functions available though, which return the number of characters.
可以将PHP 5与unicode一起使用,但是必须小心使用字符串。许多字符串函数,例如计算字符长度的字符串函数,返回字节数,而不是字符数。但是还有其他功能可用,它们返回字符数。
If this is a new project you should be able to use the right functions from the start.
如果这是一个新项目,您应该能够从一开始就使用正确的功能。
For our existing PHP project, I decided to leave it where it was (Windows 1252), due to it being an internal project and limited value for unicode (sadly, I really love unicode).
对于我们现有的PHP项目,我决定将它保留在原来的位置(Windows 1252),因为它是一个内部项目,并且unicode的价值有限(遗憾的是,我真的很喜欢unicode)。
#3
0
In my cases Postgresql was better than MySQL, MySQL do not completely support Unicode
在我的情况下,Postgresql比MySQL好,MySQL不完全支持Unicode
#4
-1
Postgresql + PHP6 is good choice
Postgresql + PHP6是不错的选择
#1
7
Mysql does not have full support for Unicode (eg: Chinese characters outside the BMP) (see). It uses a crippled 'utf8' encoding (not really UTF-8).
Mysql没有完全支持Unicode(例如:BMP之外的中文字符)(参见参考资料)。它使用了残缺的'utf8'编码(不是真正的UTF-8)。
Postgresql seems to have full support for UTF-8 encoding (hence, for all Unicode characters).
Postgresql似乎完全支持UTF-8编码(因此,对于所有Unicode字符)。
#2
1
Databases:
In my experience, both MySQL and Postgres handled Unicode quite okay.
根据我的经验,MySQL和Postgres都处理Unicode非常好。
Languages:
- PHP <=5.3 is somewhat restricted in regard to unicode, while the upcoming PHP 6 promises to fix that.
- Ruby 1.8 had poor unicode support, but 1.9 is said to handle unicode nicely (I have no own experience there).
PHP <= 5.3在unicode方面有所限制,而即将推出的PHP 6有望解决这个问题。
Ruby 1.8的unicode支持很差,但据说1.9可以很好地处理unicode(我没有自己的经验)。
Restrictions of PHP 5.3:
PHP 5.3的限制:
It is possible to use PHP 5 together with unicode, but then one has to be careful with strings. Many string functions, for instance the one which counts the length of characters, returns the number of bytes, not the number of characters. There are are additional functions available though, which return the number of characters.
可以将PHP 5与unicode一起使用,但是必须小心使用字符串。许多字符串函数,例如计算字符长度的字符串函数,返回字节数,而不是字符数。但是还有其他功能可用,它们返回字符数。
If this is a new project you should be able to use the right functions from the start.
如果这是一个新项目,您应该能够从一开始就使用正确的功能。
For our existing PHP project, I decided to leave it where it was (Windows 1252), due to it being an internal project and limited value for unicode (sadly, I really love unicode).
对于我们现有的PHP项目,我决定将它保留在原来的位置(Windows 1252),因为它是一个内部项目,并且unicode的价值有限(遗憾的是,我真的很喜欢unicode)。
#3
0
In my cases Postgresql was better than MySQL, MySQL do not completely support Unicode
在我的情况下,Postgresql比MySQL好,MySQL不完全支持Unicode
#4
-1
Postgresql + PHP6 is good choice
Postgresql + PHP6是不错的选择