I have to use the same database for two apps one with yii as backend php and other with django the problem that i have is when i save a name for example in yii "Angela CR Céspedes RodrÃguez" vs in django "Angela CR Céspedes Rodríguez" i need save in django in the same way.
Asked
Active
Viewed 50 times
-2
-
1Starting with `s = u'Angela CR Céspedes Rodríguez'`, `print s.encode('utf-8').decode('latin-1')` outputs `'Angela CR Céspedes RodrÃguez'`. But why would you want this? – snakecharmerb Sep 02 '17 at 20:27
-
thanks i need this for compatibility with the old backend – cristian camilo cedeño gallego Sep 02 '17 at 20:43
1 Answers
1
See Mojibake in Trouble with utf8 characters; what I see is not what I stored
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
...
'OPTIONS': {
'charset': 'utf8mb4',
'use_unicode': True, },
},
}
my.cnf:
[mysqld]
character-set-server=utf8mb4
default-collation=utf8mb4_unicode_ci
[client]
default-character-set=utf8mb4
And see http://stackoverflow.com/questions/28523138/django-character-latin1-mysql

Rick James
- 135,179
- 13
- 127
- 222