摘要: etc/my.ini[client]#password = your_passwordport = 3306socket = /var/lib/mysql/mysql.sockdefault-character-set=utf8# The MySQL server[mysqld]port = 3306socket = /var/lib/mysql/mysql.sockskip-lockingkey_buffer_size = 384Mmax_allowed_packet = 1Mtable_open_cache = 512sort_buffer_size = 2Mread_buffer_siz 阅读全文
posted @ 2011-12-02 21:59 SophiaTang 阅读(405) 评论(0) 推荐(0)
摘要: 9.1.5.Configuring the Character Set and Collation for ApplicationsFor applications that store data using the default MySQL character set and collation (latin1, latin1_swedish_ci), no special configuration should be needed. If applications require data storage using a different character set or colla 阅读全文
posted @ 2011-12-02 21:56 SophiaTang 阅读(261) 评论(0) 推荐(0)
摘要: MySQL算法工作 utf8_unicode_ci校对规则仅部分支持Unicode校对规则算法。一些字符还是不能支持。并且,不能完全支持组合的记号。utf8_general_ci是一个遗留的 校对规则,不支持扩展。它仅能够在字符之间进行逐个比较。这意味着utf8_general_ci校对规则进行的比较速度很快,但是与使用 utf8_unicode_ci的校对规则相比,比较正确性较差)。 对于一种语言仅当使用utf8_unicode_ci排序做的不好时,才执行与具体语言相关的utf8字符集校对规则。例如,对于德语和法语,utf8_unicode_ci工作的很好,因此不再需要为这两种语言创建特殊的 阅读全文
posted @ 2011-12-02 21:55 SophiaTang 阅读(386) 评论(0) 推荐(0)
摘要: 首先要搞清楚,字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode,再从unicode编码(encode)成另一种编码。decode的作用是将其他编码的字符串转换成unicode编码,如str1.decode('gb2312'),表示将gb2312编码的字符串转换成unicode编码。encode的作用是将unicode编码转换成其他编码的字符串,如str2.encode('gb2312'),表示将unicode编码的字符串转换成gb2312编码 阅读全文
posted @ 2011-12-02 21:49 SophiaTang 阅读(247) 评论(0) 推荐(0)
摘要: django是一个不错的WEB开源框架。今天测试,发现有些页面中文乱码,肯定是编码哪儿出了问题。django配置要修改settings. 阅读全文
posted @ 2011-12-02 21:47 SophiaTang 阅读(359) 评论(0) 推荐(0)
摘要: 在django admin界面添加汉字内容时发现如下错误:?<SPAN style="FONT-SIZE: 14px">Warning at /admin/flatpages/flatpage/add/Incorrect string value: '\xE5\x93\x88\xE5\x93\x88...' for column 'content' at row 1Request Method: POST Request URL: http://127.0.0.1:8000/admin/flatpages/flatpage/add 阅读全文
posted @ 2011-12-02 21:46 SophiaTang 阅读(1141) 评论(1) 推荐(0)
摘要: 今天在为数据库中的某两个字段设置unique索引的时候,出现了Specified key was too long; max key length is 1000 bytes错误,经过查询才知道,是Mysql的字段设置的太长了,于是我把这两个字段的长度改了一下就好了。建立索引时,数据库计算key的长度是累加所有Index用到的字段的char长度后再按下面比例乘起来不能超过限定的key长度1000:latin1 = 1 byte = 1 characteruft8 = 3 byte = 1 charactergbk = 2 byte = 1 character举例能看得更明白些,以GBK为例:C 阅读全文
posted @ 2011-12-02 21:44 SophiaTang 阅读(600) 评论(0) 推荐(0)
摘要: The Secret Name of List Comprehensions (Python recipe) by Chris PerkinsActiveState Code (http://code.activestate.com/recipes/204297/)▲5▼Sometimes you want to have a list comprehension refer to itself, but you can't because it isn't bound to a name until after it is fully constructed. However 阅读全文
posted @ 2011-12-02 14:03 SophiaTang 阅读(217) 评论(0) 推荐(0)