I've done similar stuff to try and catch unicode errors too. I guess my
point is since pylons pushes unicode and mako pushes unicode python will
all be in unicode with version 3, why write code to catch an error, when
it doesn't have to be an error? doesn't adding the magic encoding
comment remove the need for much of the code we write to "catch them"?
Martin Brabham wrote:
> A lot of times in our apps, we use the ignore option for utf8. We get
> unicode errors in our mako mostly, from titles of auctions, and other
> things of that nature. I've even experienced them in URL's. We catch
> it like this:
>
> offendingString = offendingString.decode('utf8', 'ignore')
>
> This might not be exactly what you are asking, but I hope it helps.
>
> On Mon, Mar 16, 2009 at 10:07 PM, Jose Galvez <[email protected]
> <mailto:[email protected]>> wrote:
>
>
> I've had issues in the past with unicode being "injected" into my apps
> usually from database entries. Most of these problems could mostly
> likely be avoided if I had added # -*- coding: utf-8 to the top of my
> controllers. But why isn't this the default behavior? If I make a
> controller with paster controller <controllername> shouldn't this be
> added to the top by default? especially since everything in pylons is
> supposed to be in unicode it would make things easer wouldn't it?
> Also
> will any of this be needed once python switches to unicode as the
> default?
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---