I am using webfactional for hosting my site. I created my database from the control panel with utf8 as the encoding. I want my application to be able to use other characters than English like Japanese etc.. This is one of my models:
class AcProjectMessages(models.Model): milestone_id = models.ForeignKey('AcProjectMilestones', db_column = "milestone_id", blank=True) project_id = models.ForeignKey('Project', db_column = "project_id") category_id = models.ForeignKey('AcProjectMsgCategories', db_column = "category_id", blank = True) title = models.CharField(max_length=300, blank=True) text = models.TextField(blank=True) additional_text = models.TextField(blank=True) is_important = models.BooleanField() is_private = models.BooleanField() comments_enabled = models.BooleanField() anonymous_comments_enabled = models.BooleanField() created_on = models.DateTimeField() created_by_id = models.ForeignKey(User, db_column = "created_by_id", related_name = 'message_created_by') updated_on = models.DateTimeField() updated_by_id = models.ForeignKey(User, db_column = "updated_by_id", related_name = 'message_updated_by') def get_absolute_url(self): return P2M_HOME_URL + "/projects/" + str(self.project_id.id) +"/messages/" + str(self.id) + "/" def get_rss_title(self): if self.updated_on > self.created_on: return str(self.title) + " updated by: " + str(self.updated_by_id) else: return str(self.title) + " created by: " + str(self.created_by_id) def __unicode__(self): return self.title class Admin: list_display = ('title','created_on','updated_on',) list_filter = ('created_on','updated_on',) search_fields = ('title') ordering = ('-updated_on',) class Meta: ordering = ('-updated_on',) db_table = u'ac_project_messages' verbose_name = u'Project Message' verbose_name_plural = u'Project Messages' I checked whether utf8 is supported in my database so I did something like this: [EMAIL PROTECTED] p2m]$ python manage.py dbshell; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1761118 Server version: 5.0.45 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> status; -------------- Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (i686) using readline 5.0 Connection id: 1761118 Current database: natesmith00_tam Current user: [EMAIL PROTECTED] SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.0.45 Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: utf8 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /var/lib/mysql/mysql.sock Uptime: 21 days 16 hours 43 min 54 sec Threads: 2 Questions: 35633901 Slow queries: 0 Opens: 1531178 Flush tables: 1 Open tables: 64 Queries per second avg: 19.008 -------------- mysql> desc ac_project_messages; +----------------------------+---------------------+------+----- +---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------------------+---------------------+------+----- +---------------------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | milestone_id | int(10) unsigned | YES | MUL | NULL | | | project_id | int(10) unsigned | YES | MUL | NULL | | | category_id | int(10) unsigned | NO | | 0 | | | title | varchar(100) | YES | | NULL | | | text | text | YES | | NULL | | | additional_text | text | YES | | NULL | | | is_important | tinyint(1) unsigned | NO | | 0 | | | is_private | tinyint(1) unsigned | NO | | 0 | | | comments_enabled | tinyint(1) unsigned | NO | | 0 | | | anonymous_comments_enabled | tinyint(1) unsigned | NO | | 0 | | | created_on | datetime | NO | MUL | 0000-00-00 00:00:00 | | | created_by_id | int(10) unsigned | YES | | NULL | | | updated_on | datetime | NO | | 0000-00-00 00:00:00 | | | updated_by_id | int(10) unsigned | YES | | NULL | | +----------------------------+---------------------+------+----- +---------------------+----------------+ 15 rows in set (0.00 sec) when I am trying to insert something like 東証全面安 it is giving me warning saying Environment: Request Method: POST Request URL: http://natesmith00.webfactional.com/projects/2450/messages/add/ Django Version: 1.0-final-SVN-unknown Python Version: 2.5.1 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.comments', 'p2m.projects', 'p2m.communication', 'p2m.static_pages', 'p2m.master', 'p2m.company', 'p2m.accounts', 'p2m.p2m_files', 'p2m.misc'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware') Traceback: File "/home/natesmith00/webapps/django_1/lib/python2.5/django/core/ handlers/base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File "/home/natesmith00/webapps/django_1/lib/python2.5/django/contrib/ auth/decorators.py" in __call__ 67. return self.view_func(request, *args, **kwargs) File "/home/natesmith00/webapps/django_1/p2m/projects/views.py" in new_message 895. message.save() File "/home/natesmith00/webapps/django_1/lib/python2.5/django/db/ models/base.py" in save 307. self.save_base(force_insert=force_insert, force_update=force_update) File "/home/natesmith00/webapps/django_1/lib/python2.5/django/db/ models/base.py" in save_base 379. result = manager._insert(values, return_id=update_pk) File "/home/natesmith00/webapps/django_1/lib/python2.5/django/db/ models/manager.py" in _insert 138. return insert_query(self.model, values, **kwargs) File "/home/natesmith00/webapps/django_1/lib/python2.5/django/db/ models/query.py" in insert_query 888. return query.execute_sql(return_id) File "/home/natesmith00/webapps/django_1/lib/python2.5/django/db/ models/sql/subqueries.py" in execute_sql 308. cursor = super(InsertQuery, self).execute_sql(None) File "/home/natesmith00/webapps/django_1/lib/python2.5/django/db/ models/sql/query.py" in execute_sql 1700. cursor.execute(sql, params) File "/home/natesmith00/webapps/django_1/lib/python2.5/django/db/ backends/util.py" in execute 19. return self.cursor.execute(sql, params) File "/home/natesmith00/webapps/django_1/lib/python2.5/django/db/ backends/mysql/base.py" in execute 83. return self.cursor.execute(query, args) File "build/bdist.linux-i686/egg/MySQLdb/cursors.py" in execute 168. if not self._defer_warnings: self._warning_check() File "build/bdist.linux-i686/egg/MySQLdb/cursors.py" in _warning_check 82. warn(w[-1], self.Warning, 3) File "/usr/local/lib/python2.5/warnings.py" in warn 62. globals) File "/usr/local/lib/python2.5/warnings.py" in warn_explicit 102. raise message Exception Type: Warning at /projects/2450/messages/add/ Exception Value: Incorrect string value: '\xE6\x9D\xB1\xE8\xA8\xBC...' for column 'title' at row 1 Whats the problem?? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---