Thursday, February 24, 2011

Re: Problem with unicode in form posts

On Thursday, February 24, 2011 01:32:11 am Tom Evans wrote:

> On Wed, Feb 23, 2011 at 9:17 PM, Lee Hinde <leehinde@gmail.com> wrote:

> > Except, now the data that's in the database for the username field

> > goes from looking like this:

> > leehinde

> > to this

> > (u'leehinde',)

> >

> > I'd like it to be 'leehinde' again

> > so, clearly objects.create is more clever than my pure post. But I'm

> > not sure where in the food chain I should be interceding..

>

> http://docs.djangoproject.com/en/1.2/ref/unicode/#general-string-handling

>

> """

> In most cases when Django is dealing with strings, it will convert

> them to Unicode strings before doing anything else. So, as a general

> rule, if you pass in a bytestring, be prepared to receive a Unicode

> string back in the result.

> """

>

> Be prepared :)

>

> Cheers

>

> Tom

But that doesn't explain the tuple form, (u'', ) of the return value.

That's what got me.

Mike

--

Now is the time for all good men to come to.

-- Walt Kelly

No comments:

Post a Comment