什么MySQL排序规则/字符集应该用于英语和西班牙语? [英] What MySQL collation/character set should I use for English and Spanish?

查看:231
本文介绍了什么MySQL排序规则/字符集应该用于英语和西班牙语?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用英语和西班牙语构建一个PHP5 PHP应用程序。我应该将字符集和排序规则设置为UTF8,然后将所有数据转换为mbstring数据库?或者,我应该使用某种支持英语和西班牙语的拉丁字符集吗?应用程序仅限于美国,并且不需要支持全部国际语言范围。

I'm building an PHP5 application with MySQL for English and Spanish speaking. Should I set the character set and collation to UTF8 and then convert everything into the database with mbstring? Or, should I use some kind of latin character set that supports both English and Spanish? The application is strictly US only and it doesn't need to support the full international range of languages.

我在大多数项目中使用CodeIgniter。我只注意到CI数据库设置。

I'm using CodeIgniter on most projects. I just noticed the CI Database settings.

$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';

所以,我假设这两个设置应该是好的。我假设我需要重置MySQL数据库字符集和数据库和表上的任何排序规则设置?

So, I assume these two settings should be good. I assume I need to reset the MySQL database char set and any collation settings on the db and tables?

推荐答案

将字符集设置为UTF8,在数据库中的php

Set the charset to UTF8 both in php and in the database.

在数据库的所有表中使用排序规则 utf8_latin_ci

Use collation utf8_latin_ci in all tables in the database.

请参阅: http://dev.mysql.com/ doc / refman / 5.5 / en / charset-general.html

这篇关于什么MySQL排序规则/字符集应该用于英语和西班牙语?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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