|
List Info
Thread: A basic problem with templates (I think)
|
|
| A basic problem with templates (I think) |

|
2006-12-28 14:18:01 |
I don't know why, but when I write or take from the Database
a word
with some kind of accent, Django shows a "?"
instead. Why?? I've
changed the language in settings.py and even the TimeZone.
If I escape
the chars with something like "á" it
works, so isn't a problem
with my browser, right?
Does anybody knows what can be it?? I've made a simple test
to see what
the template returns, and it returns the "string"
below:
>>> t = Template("My special letters are :
αινσϊ")
>>> c = Context({})
>>> t.render(c)
'My special letters are : xe1xe9xedxf3xfa'
>>> print t.render(c)
My special letters are : αινσϊ
>>>
Any idea?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| A basic problem with templates (I think) |

|
2006-12-28 17:39:08 |
Hi,
The sample string below appears correctly (ie. no
"?"'s) for me; are
you saying that it does for you, or that it doesn't?
If you're just having a problem with rendered HTML: I'm not
sure how
you're entering those characters, but I'm guessing that
they're being
stored as Unicode characters, or at least, something outside
whatever
the default charset used by HTML is. If so: Are you putting
the
appropriate headers in your HTML document to tell your Web
browser
that you're using Unicode, as opposed to the
more-traditional ASCII?
Those escapes exist for a reason, namely, that the
characters that
they represent don't normally work in an HTML file.
Adam
On Dec 28, 2006, at 9:18 AM, dutche wrote:
>
> I don't know why, but when I write or take from the
Database a word
> with some kind of accent, Django shows a "?"
instead. Why?? I've
> changed the language in settings.py and even the
TimeZone. If I escape
> the chars with something like "á"
it works, so isn't a problem
> with my browser, right?
>
> Does anybody knows what can be it?? I've made a simple
test to see
> what
> the template returns, and it returns the
"string" below:
>
>>>> t = Template("My special letters are :
αινσϊ")
>>>> c = Context({})
>>>> t.render(c)
> 'My special letters are : xe1xe9xedxf3xfa'
>>>> print t.render(c)
> My special letters are : αινσϊ
>>>>
>
>
> Any idea?
>
> Thanks
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| A basic problem with templates (I think) |

|
2006-12-28 18:49:35 |
On Thursday 28 December 2006 11:18, dutche wrote:
> I don't know why, but when I write or take from the
Database a word
> with some kind of accent, Django shows a "?"
instead. Why?? I've
> changed the language in settings.py and even the
TimeZone. If I escape
> the chars with something like "á"
it works, so isn't a problem
> with my browser, right?
Well, your browser may not be detecting the "character
encoding" correctly. If
your data comes from a database that has it stored as
"ISO-8859-1" and the
browser thinks it's UTF-8, generally you get a mess. Equally
important is the
character encoding that your editor uses when it saves files
like templates.
Your best bet is to standarize on one character encoding.
Using UTF-8 for
everything is probably the most future-proof.
>
> Does anybody knows what can be it?? I've made a simple
test to see what
>
> the template returns, and it returns the
"string" below:
> >>> t = Template("My special letters are
: αινσϊ")
> >>> c = Context({})
> >>> t.render(c)
>
> 'My special letters are : xe1xe9xedxf3xfa'
>
> >>> print t.render(c)
>
> My special letters are : αινσϊ
>
>
If you do something on the commandline, you also have to
check what encoding
is being used by your terminal to display the characters
back to you.
>
> Any idea?
It is a mess, and has been for a while. It will go away when
everybody agrees
to use the same encoding. I fear, it will be with us for a
long time :-/.
>
> Thanks
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| A basic problem with templates (I think) |

|
2006-12-28 19:36:33 |
Exactly like Vriens said, it's a problem of encoding.
Your best bet is to use UTF-8 all across. Set your DB to use
UTF-8, use
a UTF-8 capable editor, add a meta tag to your html to
indicate the
UTF-8 encoding. etc.
On Dec 28, 11:49 am, "Marijn P. Vriens"
<mar... metronomo.cl> wrote:
> On Thursday 28 December 2006 11:18, dutche wrote:
>
> > I don't know why, but when I write or take from
the Database a word
> > with some kind of accent, Django shows a
"?" instead. Why?? I've
> > changed the language in settings.py and even the
TimeZone. If I escape
> > the chars with something like
"á" it works, so isn't a problem
> > with my browser, right?Well, your browser may not
be detecting the "character encoding" correctly.
If
> your data comes from a database that has it stored as
"ISO-8859-1" and the
> browser thinks it's UTF-8, generally you get a mess.
Equally important is the
> character encoding that your editor uses when it saves
files like templates.
>
> Your best bet is to standarize on one character
encoding. Using UTF-8 for
> everything is probably the most future-proof.
>
>
>
> > Does anybody knows what can be it?? I've made a
simple test to see what
>
> > the template returns, and it returns the
"string" below:
> > >>> t = Template("My special letters
are : αινσϊ")
> > >>> c = Context({})
> > >>> t.render(c)
>
> > 'My special letters are : xe1xe9xedxf3xfa'
>
> > >>> print t.render(c)
>
> > My special letters are : αινσϊIf you do something
on the commandline, you also have to check what encoding
> is being used by your terminal to display the
characters back to you.
>
>
>
> > Any idea?It is a mess, and has been for a while.
It will go away when everybody agrees
> to use the same encoding. I fear, it will be with us
for a long time :-/.
>
>
>
> > Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| A basic problem with templates (I think) |

|
2006-12-28 21:20:45 |
On Dec 28, 2006, at 1:49 PM, Marijn P. Vriens wrote:
>> Any idea?
>
> It is a mess, and has been for a while. It will go away
when
> everybody agrees to use the same encoding. I fear, it
will be with
> us for a long time :-/.
In theory, you should be escaping the accented characters
into HTML
entities. Even if you have the encoding set correctly on
the server
and source side, the user can still explicitly set the
(possibly
wrong) encoding in the browser.
---
David Zhou
david nodnod.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| A basic problem with templates (I think) |

|
2006-12-29 01:38:19 |
On 28-Dec-06, at 7:48 PM, dutche wrote:
> I don't know why, but when I write or take from the
Database a word
> with some kind of accent, Django shows a "?"
instead.
are you sure its django and not your browser - did you try
other
browsers?
--
regards
kg
http://lawgon.livejourn
al.com
http://nrcfosshelpline
.in/web/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-6]
|
|