Problem with encoding (INSERT web2py)

33 views
Skip to first unread message

Luciano Fain

unread,
Sep 22, 2019, 2:43:42 AM9/22/19
to web...@googlegroups.com
Dear Team

I have a string with an special charater on it:  'SECRETARÍA XXX'

When i try to do an insert on DB

id_encabezado = db.encabezado.insert(tipo_reg = 0,nombre_cliente = 'SECRETARÍA' )

got the following error:

<faultstring>'ascii' codec can't decode byte 0xc3 in position 942: ordinal not in range(128)</faultstring>

I have tried:

nombre_cliente = unicode ('SECRETARÍA')

nombre_cliente = ('SECRETARÍA').encode('utf-8)

and nothing seems to work

Massimo Di Pierro

unread,
Sep 22, 2019, 2:47:28 AM9/22/19
to web2py-users
Can you try?

nombre_cliente = u'SECRETARÍA'

What is your connection string? which python version?

Massimo Di Pierro

unread,
Sep 22, 2019, 2:47:58 AM9/22/19
to web2py-users
... and can you show us the complete traceback?

Luciano Fain

unread,
Sep 22, 2019, 8:05:43 AM9/22/19
to web...@googlegroups.com
I installed psycopg2 and all work fine now. Thanks anyway Massimo


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/4e6457db-20f5-422c-9bc0-02a53f5ce689%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages