2

Django comes with unicode support out of the box and it supports utf-8 by default. Say that you have developed, debugged and tested successfully a site with a bunch of Django apps in utf-8. What steps are required for a mostly painless migration to a different encoding, say latin-1 ? I would wish that it would just need setting DEFAULT_CHARSET = 'latin-1' and changing the encoding of the database but I somehow doubt it is that simple.

For the sake of the discussion you can ignore the migration of any already stored utf-8 data in the database; I'm mostly interested in the required checks and changes in the Django code as well the database and web server configuration.

gsakkis
  • 1,569
  • 1
  • 15
  • 24

1 Answers1

2

You shouldn't need to make significant changes to your Django codebase. Even though your working characterset will be UTF-8, the data will be stored in your database using the database's chosen encoding.

Do you have a really Really REALLY good reason for moving from UTF-8 to latin-1?

If you're concerned about the character encoding of the output, you probably want to deal with that by using the referenced setting, rather than at the database level where you may lose data.

There's more info about that here:

http://docs.djangoproject.com/en/dev/ref/unicode/

Paul McMillan
  • 19,693
  • 9
  • 57
  • 71