Can you please open a ticket on google code?

On Jun 3, 10:16 am, Luciano <ldmo...@gmail.com> wrote:
> There is a problem of encoding, to write data to fields of type
> "list:string" in gae.
>
> When we have a field of type "list: string" and try to write data in
> this field, the method represents web2py run () class NoSQLAdapter (),
> is present in web2py/gluon/dal.py, and str (x) in line 2633. However
> the environment gae (SDK), will run unicode (value). encode ('utf-8')
>
> Look at the example:
>
> # In web2py>>> def w2p(x):
>
> ...      """
> ...      executed in the method represent()
> ...      """
> ...      return str(x)
>
> # In gae>>> def gae(value):
>
> ...      """
> ...      Implemented in gae before saving
> ...      """
> ...      return unicode(value).encode('utf-8')
>
> Thus, the instructions will cause an error when we try to enter
> accented characters in this field, no matter how we send data to write
> in this field. The errors presented are:
>
> Example 1 - error in gae():>>> x = 'ãé'
> >>> value = w2p(x)
> >>> gae(value)
>
> Traceback (most recent call last):
>   File "<input>", line 1, in <module>
>   File "<input>", line 3, in gae
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 0: ordinal not in range(128)
>
> Example 2 - error in web2py:>>> x = 'ãé'
> >>> x = 'ãé'.decode('utf-8')
> >>> value = w2p(x)
>
> Traceback (most recent call last):
>   File "<input>", line 1, in <module>
>   File "<input>", line 6, in w2p
> UnicodeEncodeError: 'ascii' codec can't encode characters in position
> 0-1: ordinal not in range(128)

Reply via email to