Hi, I was using an web2py app on : Windows Server 2016 2.18.2-stable+timestamp.2019.02.26.06.11.06 (Running on Rocket 1.2.6, Python 2.7.9)
Now, I'm using : Centos 7 2.27.1-stable+timestamp.2023.11.15.23.33.20 (Running on Unknown, Python 2.7.5) I'm having lots of encode problems. Take this sample code : # -*- coding: utf-8 -*- from __future__ import unicode_literals def myFunction(): my_unicode = 'Eusébio' my_goals = db.executesql("SELECT * FROM goals WHERE scorer = '{}';".format(my_unicode), as_dict = True) return dict(my_goals) Calling /myapp/test/myFunction works fine on my Windows machine, but fails on Centos 7 : Traceback (most recent call last): File "<obfuscated>/web2py/gluon/restricted.py", line 219, in restricted exec(ccode, environment) File " <obfuscated> /web2py/applications/ <obfuscated> /controllers/test.py", line 7, in <module> File " <obfuscated> /web2py/gluon/globals.py", line 463, in <lambda> self._caller = lambda f: f() File " <obfuscated> /web2py/applications/ <obfuscated> /controllers/test.py", line 5, in myFunction my_goals = db.executesql("SELECT * FROM goals WHERE scorer = '{}';".format(my_unicode), as_dict = True) File " <obfuscated> /web2py/gluon/packages/dal/pydal/base.py", line 882, in executesql adapter.execute(query) File " <obfuscated> /web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 70, in wrap return f(*args, **kwargs) File " <obfuscated> /web2py/gluon/packages/dal/pydal/adapters/mssql.py", line 128, in execute args[0] = to_unicode(args[0]) File " <obfuscated> /web2py/gluon/packages/dal/pydal/_compat.py", line 173, in to_unicode return obj.decode(charset, errors) File "/usr/lib64/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 39: ordinal not in range(128) I'm now considering installing Python3 (Check my other post : Shell.py, unqualified exec is not allowed), or would it be safer to stay with Python2.7.5 and just install an older version of web2py ? Can you help explain this error to me ? Alexandre -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/94f17ba1-78c6-48ee-8782-56b19137dbd6n%40googlegroups.com.