[web2py] Re: Encoding problem with a web2py application that implements an XMLRPC webservice

2019-07-17 Thread Lisandro
Thank you for your suggestions. As I'm not uploading text files from the browser, I don't need to encode/decode, I just need to set default encoding to utf8. Considering that, I've gone ahead with Alfonso's suggestion and I've moved sys.setdefaultencoding('utf8') inside my routes.py. It's worki

[web2py] Re: Encoding problem with a web2py application that implements an XMLRPC webservice

2019-07-06 Thread Alfonso Serra
sys.setdefaultencoding will work thorough the server execution process. So as long it is alive you wont need to call it several times. It will probably work if you set that up on routes.py or web2py.py so its not called per request. As long as it fixes your problem i wouldnt care whether it is

[web2py] Re: Encoding problem with a web2py application that implements an XMLRPC webservice

2019-07-06 Thread Dave S
On Thursday, July 4, 2019 at 2:04:49 PM UTC-7, Lisandro wrote: > > I presumed that I could add "# -*- coding: utf-8 -*-" and forget about > the encoding problems. > > What should I do? > I believe that line only specifies that the source code is in utf-8. You probably need to use a codec, w

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-22 Thread juan
Hi Massimo, I am also not convinced since I'm new to web2py and python, but It works fine, as expected in every case I have tested with that little correction and a format attribute like this (*nombre* is a *string*, and *precio *is a *decimal(2,2):* format=lambda row: row.nombre + ' - ' + str

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-22 Thread Massimo Di Pierro
I am not sure I am convinced this return (refs and ', '.join(f(r,x.id) for x in refs) or '') always works but for now it is in trunk. On Wednesday, 21 August 2013 19:26:45 UTC-5, juan wrote: > > The issue wasnt completely resolved that way, there were problems with > list:reference in updates a

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-21 Thread juan
The issue wasnt completely resolved that way, there were problems with list:reference in updates and some weird behaviour, always involving lists but no simple references, so I debugged my way down to the web2py code and finally found the problem. In the line 6860 of the file gluon/dal.py, this

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-20 Thread juan
Well, I found a solution for this strangely undocumented issue: format=lambda r: r.nombre.decode("utf-8", 'ignore') + ' - ' + str(r.precio) + '€'.decode("utf-8", 'ignore') Then, using the lambda and decode, it works. Maybe that the 'ignore' isn't neccesary, but I left there just in case. El lu

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-19 Thread juan
Thank you Massimo, but how can it be resolved when the format attribute must represent fields in the database with special chars?. I mean, the hardcoded euro char is the minor problem here. Thanks El jueves, 15 de agosto de 2013 04:07:53 UTC-5, Massimo Di Pierro escribió: > > replace > form

[web2py] Re: Encoding problem in 'format' from define_table on GAE

2013-08-15 Thread Massimo Di Pierro
replace format="%(nombre)s - %(precio)s€" with format= "%(nombre)s - %(precio)s\xe2\x82\xac" because labels mush be in ascii (or utf8) but not unicode. On Wednesday, 14 August 2013 15:57:24 UTC-5, juan wrote: > > Hello, > > It seems that the format option in db.define_table isn't working prop

[web2py] Re: encoding problem

2011-03-10 Thread Eduardo
Alright, neither opening in NotePad and resaving with different encodings nor copying from one editor to another worked. Opening on NotePad++, however, and copying/pasting to a new file on the same editor, then saving as UTF-8 solved the problem. Eduardo On 10 mar, 13:23, Massimo Di Pierro wrot

[web2py] Re: encoding problem

2011-03-10 Thread Eduardo
I edited appadmin.py via Notepad++ configured to save as UTF-8 (the file itself already begins with # -*- coding: utf-8 -*-). Exactly the same way I typed the Portuguese characters on appadmin.html (which are displayed correctly). Note that appadmin.py isn't displayed correctly through the framew

[web2py] Re: encoding problem

2011-03-10 Thread Massimo Di Pierro
How did you edit using utf8 or did you insert latin-1 chars? On Mar 10, 9:44 am, Eduardo wrote: > Hi, > > I modified the insert( ) function of appadmin.py from the example app > by passing a dict to the labels attribute of SQLFORM( ) - in other > words: > > appadmin.py > insert( ) > SQLFORM(.

Re: [web2py] Re: encoding problem

2011-01-26 Thread Marin Pranjic
Problem solved! Browser issue. On Wed, Jan 26, 2011 at 10:26 PM, Marin Pranjic wrote: > I think urlencoding is the problem. > > If I run > http://example.com/cont/func?var=š > > it encodes into > > http://example.com/cont/func?var=%9A > > if I define con

Re: [web2py] Re: encoding problem

2011-01-26 Thread Marin Pranjic
I think urlencoding is the problem. If I run http://example.com/cont/func?var=š it encodes into http://example.com/cont/func?var=%9A if I define controller-function def func: return request.vars.var I get the symbol � as output However - return 'š

[web2py] Re: encoding problem

2011-01-26 Thread Niphlod
did you look into http://code.google.com/p/jquery-json/issues/detail?id=43 ? json.loads in web2py fits well with unicode maybe it's jquery- json and browser implementation that screws something up. On 26 Gen, 20:51, Marin Pranjic wrote: > It's not web2py related, but I hope someone can help