Opened 13 years ago
Closed 13 years ago
#18790 closed Bug (fixed)
Non-ascii characters in password for database settings don't work
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.4 |
| Severity: | Normal | Keywords: | unicode |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
An UnicodeError is raised when using a password that contains non-ascii characters.
For example the following settings cause an error when I run ./manage.py syncdb.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'DBName',
'USER': 'DBUser',
'PASSWORD': u'je suis français',
'HOST': 'localhost',
'PORT': '5432',
}
}
To run ./manage.py runserver with an empty project (just update the settings) you have to add the magix comment on top of the file :
# -*- coding: utf-8 -*-
Attachments (1)
Change History (5)
comment:1 by , 13 years ago
| Component: | Core (Management commands) → Database layer (models, ORM) |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 13 years ago
Note also that psycopg2 < 2.4.3 will also choke on spaces, backslashes or quotes.
http://psycopg.lighthouseapp.com/projects/62710/tickets/87-psycopg2connect-fails-when-using-spaces-in-password-keyword
https://dndg.it/cgi-bin/gitweb.cgi?p=public/psycopg2.git;a=commit;h=625cc1b402b33799757fb9b8fe421a2ea63e1236
comment:3 by , 13 years ago
| Has patch: | set |
|---|
Someone should test it with oracle to see if the password encoding is also needed.
comment:4 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Confirmed that the Python 2 psycopg adapter does not support unicode password input (OK with Python 3).