Monday, November 16, 2009

Re: Encoding ISO-8859-1


On Mon, Nov 16, 2009 at 10:08 AM, ulferik <ulferik@yahoo.com> wrote:
Thank's Karen for your reply.
With php+smarty I do the same I make a base template on which I have
some
stuff that is the same for all. In the template I place a meta tag
with charset=ISO-8859-1
and everything is fine.

The meta tag, I'd guess, will affect how the browser interprets the data.
 
With Django it doesn't make any difference
what I place in meta or
xml tags. The template is processed and it is UTF-8 whether I like it
or not.
This not a matter of database or views or models it is a base
template.
I have read the manual regarding charset and I can't make any sence
from it. What I need
is an example that shows how to...


FILE_CHARSET is a setting, so you need to put it in your settings.py file, not in any template file. Include:

FILE_CHARSET = 'iso-8859-1'

in your settings.py file (and, if necessary, restart your server).  Then Django will stop assuming that your template files are encoded in utf-8 and instead will read them assuming iso-8859-1 encoding.

Note if you also want to retrain this encoding, instead of utf-8, for all responses sent by your application, you will need to also set DEFAULT_CHARSET:

http://docs.djangoproject.com/en/dev/ref/settings/#default-charset

By default Django will encode outgoing responses in utf-8, so if you want to send your responses with another encoding you need to change this one also.  But I am not sure why you would want to do that instead of just sending the response using utf-8? 

Karen


--

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 http://groups.google.com/group/django-users?hl=.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate