Edgewall Software

Changes between Initial Version and Version 1 of Ticket #3901


Ignore:
Timestamp:
Oct 10, 2006, 3:10:15 PM (18 years ago)
Author:
Christian Boos
Comment:

self.hdf.setValue(prefix.encode('utf-8'), value.encode('utf-8'))

This is not the appropriate way to do it. While it might still work that way (testing if prefix is an unicode object, then only in this case try to encode it), it's much safer to use the HDFWrapper API, which has been strengthened to allow mixed str/unicode usage (see source:tags/trac-0.10/trac/web/clearsilver.py):

req.hdf[prefix] = value

In general, you can find good advice (I hope ;) ) about usage of Unicode within Trac 0.10 in TracDev/UnicodeGuidelines.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3901

    • Property Status newclosed
    • Property Resolutioninvalid
  • Ticket #3901 – Description

    initial v1  
     1{{{
    12Traceback (most recent call last):
    23  File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 356, in dispatch_request
     
    1516    self.hdf.setValue(prefix.encode('utf-8'), value.encode('utf-8'))
    1617UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 22: ordinal not in range(128)
    17 
     18}}}
    1819We are developing a plugin that takes input from a POST form. The relevant html code:
    19 
    20                        
     20{{{
     21#!xml           
    2122                        <tr class="Jälkiruoka">
    2223                                <th scope="row">Jälkiruoka</th>
     
    4445                               
    4546                        </tr>
    46 
     47}}}
    4748we use the integrated tracd as the server atm