On 1 sep, 16:23, Max <[EMAIL PROTECTED]> wrote:
> Hi,
> I ve been trying to figure out why I can t handle utf-8 properly on my
> production server, while it works perfectly on my local django dev
> server
>
> When I try to run this line
> unicode_data.decode("utf-8")
>
> With data coming from DB
> " Rémi "
>
> I get on production only
> 'ascii' codec can't encode character u'\xe9'
>
> I spent a lot of time on the forums and I could fixed that rather
> easily on my dev server with the addition of DEFAULT_CHARSET = 'utf-8'
> in settings.py and re-defining collations and charsets in DB.
> But for some reason there is still some ascii conversion in production
> and it s driving me Crazy!!!
> I tried it all, I don t know what to do next. Please help!
>
> DEV ENV
> ------------------------------------------------------------------------------
> python 2.5.1
> Mysql: 6.0.3-alpha-community MySQL Community Server (GPL)
> django: 0.97
> os: vista
>
> PROD ENV
> ------------------------------------------------------------------------------
> python 2.4.4
> Mysql: 5.0.32-Debian_7etch1-log Debian etch distribution
> django: 0.97
> os: linux
>
> DEV DB
> -------------------------------------------------------------------------------
> character_set_client utf8
> character_set_connection utf8
> character_set_database latin1
> character_set_filesystem binary
> character_set_results utf8
> character_set_server latin1
> character_set_system utf8
> character_sets_dir C:\\Program Files\\MySQL\\MySQL Server
> 6.0\\share\\charsets\\
>
> collation_connection utf8_general_ci
> collation_database latin1_swedish_ci
> collation_server latin1_swedish_ci
>
> On every table i did a
> alter table tablename CONVERT TO CHARACTER SET utf8 collate
> utf8_general_ci
>
> PROD DB
> -------------------------------------------------------------------------------
> character_set_client utf8
> character_set_connection utf8
> character_set_database utf8
> character_set_filesystem binary
> character_set_results utf8
> character_set_server utf8
> character_set_system utf8
> character_sets_dir /usr/share/mysql/charsets/
>
> collation_connection utf8_general_ci
> collation_database utf8_general_ci
> collation_server utf8_unicode_ci
>
> On every table i did a
> alter table tablename CONVERT TO CHARACTER SET utf8 collate
> utf8_general_ci
>
> DEV SERVER: django dev server
> -----------------------------------------------------------------------------------
> no special setting
>
> PROD SERVER : apache2
> -----------------------------------------------------------------------------------
> AddDefaultCharset utf8
>
> DJANGO SETTINGS (prod and serv)
> -----------------------------------------------------------------------------------
> DEFAULT_CHARSET = 'utf-8'
> TIME_ZONE = 'America/New York'
> LANGUAGE_CODE = 'en-us'
> USE_I18N = True
I had the same error and was fix changing the encoding var in
setencoding() method from site.py ( in your python installation)
I change it from "ascii" to "UTF-8"
I hope that can help you
PS: Also, If you are using UTF-8 in your code , you need to add "#
coding=UTF-8" as a first line of your file.
--
Richard Rossel
Valparaiso - Chile
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---