[ZCM] [ZC] 565/ 2 Accept "DTML bug: size="..." breaks with unicode strings

Collector: Zope Bugs, Features, and Patches ... zope-coders@zope.org
Tue, 10 Sep 2002 15:19:34 -0400


"
X-Recipients-debug: ['jdavid', 'htrd', 'htrd', 'klm', 'Brian', 'chrism', 'Caseman', ('_Accepted_ recipient', 'zope-collector-monitor@zope.org')]

Issue #565 Update (Accept) "DTML bug: size="..." breaks with unicode strings
"
 Status Accepted, Zope/bug+solution medium
To followup, visit:
  http://collector.zope.org/Zope/565

==============================================================
= Accept - Entry #2 by htrd on Sep 10, 2002 3:19 pm

 Status: Pending => Accepted

 Supporters added: htrd


________________________________________
= Request - Entry #1 by jdavid on Sep 10, 2002 3:04 pm

Bug
---

Try the following DTML code:

 <dtml-var "u'hola y adiós'" size="6">

Traceback (innermost last):
  Module ZPublisher.Publish, line 98, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 39, in call_object
  Module OFS.DTMLMethod, line 126, in __call__
  Module DocumentTemplate.DT_String, line 474, in __call__
  Module DocumentTemplate.DT_Var, line 287, in render
  __traceback_info__: ("u'hola y adi\xf3s'", u'hola y adi\xf3s', {'size': '6', '': '"u\'hola y adi\xf3s\'"'})

UnicodeError: ASCII encoding error: ordinal not in range(128)


Solution
--------

File "lib/python/DocumentTemplate/DT_Var.py", line
287, replace "val=str(val)" by "val=ustr(val)".
==============================================================