Regarding UTF-8 and database queries.

3 views
Skip to first unread message

Emil Ahlbäck

unread,
Feb 25, 2007, 5:59:22 AM2/25/07
to Django developers, em...@eml.nu
Hello everyone.

Recently me and a friend revived an old project, in hope that Django
will offer us a non-clusterf***y way to work, and it did. It's great,
I love it. :)

I have run into a problem though, after using google a bit for finding
information in the documentation I decided to turn here.

OK, so what I am doing now is to let the user register and give us his
real name there. Names like Friedrich or so are fine, but when there
are non-ANSI (correct term?) characters we're running into problems.
My name for example is Emil Ahlbäck, and what it does when I enter it
is to cut the name at "Ahlb" and just enter that part. Both my
database and all my tables are set to have utf8_unicode_ci collation,
which should be enough I hope? Displaying UTF-8 characters are no
problems, I already tried manipulating the record manually.

So, how should I accomplish this? I also tried using the u'' stuff, as
in user_object.last_name = self.clean_data[u'last_name'], but this
didn't change anything.

Thanks in advance, Emil.

patrick k.

unread,
Feb 25, 2007, 6:14:22 AM2/25/07
to django-d...@googlegroups.com
we�re also using UTF-8 (with umlauts and special characters) and we
don�t have any problems.
do you use the right content-type?
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

btw, that question should go to "django-users".

patrick

Am 25.02.2007 um 11:59 schrieb Emil Ahlb�ck:

>
> Hello everyone.
>
> Recently me and a friend revived an old project, in hope that Django
> will offer us a non-clusterf***y way to work, and it did. It's great,
> I love it. :)
>
> I have run into a problem though, after using google a bit for finding
> information in the documentation I decided to turn here.
>
> OK, so what I am doing now is to let the user register and give us his
> real name there. Names like Friedrich or so are fine, but when there
> are non-ANSI (correct term?) characters we're running into problems.

> My name for example is Emil Ahlb�ck, and what it does when I enter it

Emil Ahlbäck

unread,
Feb 25, 2007, 6:48:02 AM2/25/07
to Django developers
Hey. Yeah I just noticed that I was in the wrong forum also. Sorry
about that.
If it's possible, perhaps an administrator could move it?

On Feb 25, 1:14 pm, "patrick k." <patr...@vonautomatisch.at> wrote:
> we?re also using UTF-8 (with umlauts and special characters) and we
> don?t have any problems.


> do you use the right content-type?
> <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
>
> btw, that question should go to "django-users".
>
> patrick
>

> Am 25.02.2007 um 11:59 schrieb Emil Ahlb?ck:
>
>
>
> > Hello everyone.
>
> > Recently me and a friend revived an old project, in hope that Django
> > will offer us a non-clusterf***y way to work, and it did. It's great,
> > I love it. :)
>
> > I have run into a problem though, after using google a bit for finding
> > information in the documentation I decided to turn here.
>
> > OK, so what I am doing now is to let the user register and give us his
> > real name there. Names like Friedrich or so are fine, but when there
> > are non-ANSI (correct term?) characters we're running into problems.

> > My name for example is Emil Ahlb?ck, and what it does when I enter it

Emil Ahlbäck

unread,
Feb 25, 2007, 6:49:16 AM2/25/07
to Django developers
Great, I forgot the point.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>


<meta http-equiv="Content-type" content="text/html;
charset=utf-8" />

This is the start of our base.html, so that should be enough, no?

patrick k.

unread,
Feb 25, 2007, 7:02:46 AM2/25/07
to django-d...@googlegroups.com
that should work.

we´re working with this though:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">


<head>
<meta http-equiv="Content-type" content="text/html;
charset=utf-8" />

patrick

Am 25.02.2007 um 12:49 schrieb Emil Ahlbäck:

>
> Great, I forgot the point.
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <meta http-equiv="Content-type" content="text/html;
> charset=utf-8" />
>
> This is the start of our base.html, so that should be enough, no?
>

Reply all
Reply to author
Forward
0 new messages