On Fri, 2007-10-26 at 15:52 -0500, Jeremy Dunck wrote:
> On 10/26/07, mamcxyz <[EMAIL PROTECTED]> wrote:
> >
> > > What's the type and value of "request.content"? What's the type and
> > > value of "text" ?
> >
> > self.response=<django.http.HttpResponse object at 0x032A21D0>
>
> Err, please give the type and value of request.*content*, not request. :)
>
> ...
> > 'content-type': ('Content-Type', 'text/html; charset=utf-8')}
> ...
> >
> > (why is utf8????)
>
> There are several different charsets in play.
> DEFAULT_CHARSET is the encoding sent back to the client.
> FILE_CHARSET is the encoding of the template and initial sql files.
> There's also TEST_DATABASE_CHARSET with is the DB encoding, of course,
> but is only used when the test runner is creating your schema in the
> test DB.
>
> In any case, your DEFAULT_CHARSET is probably still UTF-8. This
> should be OK, assuming your internal bytestrings are UTF-8.
I guess you know what you mean here, Jeremy, but just in case anybody
hits this in the archives: DEFAULT_CHARSET has nothing to do with the
internal bytestrings you pass to Django. It *only* affects the output
from the email generation and template generation functions. It's the
encoding used for text we send back to the user. You *must* use UTF-8
bytestrings or Unicode strings inside Django regardless of if
DEFAULT_CHARSET is set to "woolly-elephant" or anything. This is
documented in unicode.txt.
> The
> problem is clearly before the response, so we can worry about that
> later. :)
>
> I dunno what DB you're using, but you might ensure that the DB created
> for testing is using the same charset/encoding as your prod one.
>
> > > Err, your comment seems to suggest you're just switching the CHARSET
> > > parameter as a guess. The files really *are* in some specific
> > > charset, and the setting needs to agree. :-/
> >
> > I click in file properties in komodo and tell me that my files are in
> > utf8. However 2 o 3 (one are part in the response) stick to CP-1252,
> > no matter what I do...
All your template files are going to have to be in the same encoding.
Django trusts FILE_CHARSET and it doesn't change.
Malcolm
--
I've got a mind like a... a... what's that thing called?
http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---