#2269: Unicode error when a TextField with UnicodeString validator gets a non-
ascii value
----------------------------------------------------+-----------------------
 Reporter:  chrisz                                  |        Owner:        
     Type:  defect                                  |       Status:  closed
 Priority:  high                                    |    Milestone:  2.0rc1
Component:  TurboGears                              |      Version:  2.0b7 
 Severity:  major                                   |   Resolution:  fixed 
 Keywords:  tw.forms formencode UnicodeDecodeError  |  
----------------------------------------------------+-----------------------
Changes (by chrisz):

  * status:  new => closed
  * resolution:  => fixed

Comment:

 When I brought this up on the [http://groups.google.com/group
 /toscawidgets-discuss/browse_thread/thread/117ef0b3e8b8283d TW mailing
 list], it turned out that it is a known problem - you cannot use
 `formencode.validators.UnicodeString` with `tw.forms`, but you have to use
 `tw.forms.validators.UnicodeString` instead, which is a slightly modified
 version of the same validator that avoids this error.

 Unfortunately, this important detail was nowhere mentioned in our TG2
 documentation; but I have added this now in r6499.

 For the curious: The issue with the `UnicodeString` validator is that it
 assumes the "outside world" to use UTF-8 encoding, while the templating
 engines used by `tw.forms` expect unencoded Unicode objects. That's why
 `tw.forms` provides a modified `UnicodeString` validator that you must use
 to avoid this error.

 Btw, I have also improved the `UnicodeString` validator of !FormEncode so
 that it interprets an `outputEncoding` of None as "do not encode." So
 `tw.forms.UnicodeString()` is now actually the same as
 `formencode.validators.UnicodeString(outputEncoding=None)`. (This feature
 will be available in !FormeEcode > 1.2.2.)

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2269#comment:2>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to