Vizible’s Blog

DJango – UTF8

Posted in Programming by wearetherock on January 20, 2009

ปัญหาเมื่อเพิ่มข้อมูลในฟอร์มเป็นภาษาไทย

Warning at /admin/esystem/family/add/

Incorrect string value: '\xE0\xB8\x94\xE0\xB8\xAD...' for column 'name' at row 1
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/esystem/family/add/
Exception Type: Warning
Exception Value:
Incorrect string value: '\xE0\xB8\x94\xE0\xB8\xAD...' for column 'name' at row 1

Exception Location: /usr/lib/python2.5/warnings.py in warn_explicit, line 102
Python Executable: /usr/bin/python
Python Version: 2.5.2
Python Path: [‘/home/beer/plaint/eflower’, ‘/usr/lib/python2.5’, ‘/usr/lib/python2.5/plat-linux2’, ‘/usr/lib/python2.5/lib-tk’, ‘/usr/lib/python2.5/lib-dynload’, ‘/usr/local/lib/python2.5/site-packages’, ‘/usr/lib/python2.5/site-packages’, ‘/usr/lib/python2.5/site-packages/Numeric’, ‘/usr/lib/python2.5/site-packages/PIL’, ‘/usr/lib/python2.5/site-packages/gst-0.10’, ‘/var/lib/python-support/python2.5’, ‘/usr/lib/python2.5/site-packages/gtk-2.0’, ‘/var/lib/python-support/python2.5/gtk-2.0’, ‘/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode’]
Server time: Mon, 19 Jan 2009 21:03:32 -0600

MySql

CREATE DATABASE eflower DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

setting.py

DEFAULT_CHARSET=’utf-8′

Reference :
http://www.codenone.com/node/177
http://rollerweblogger.org/wiki/Wiki.jsp?page=SettingUpUTF8OnMySQL

Advertisements
Tagged with: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: