I should have thought about that.. the result from the print data function is:
{u'textfield': u'Viele Umlauts: \xe4\xe4\xe4\xfc\xfc\xfc\xdc\xdc\xdc\xd6\xd6\xd6\xe4\xe4\xe4', u'name': u'\xdcberprufen'} for the following data sent: data = { name : "Überprufen", textfield : "Viele Umlauts: äääüüüÜÜÜÖÖÖäää" } On Wed, Nov 10, 2010 at 15:23, mdipierro <mdipie...@cs.depaul.edu> wrote: > If you start web2py from the console you should see the output to the > console. You can also print to a file or log the output if that makes > it easier. > > On Nov 10, 5:47 am, Omri <omri...@gmail.com> wrote: > > sorry for the stupid question - but how can I call the "print data" > function > > inside a function that is called through JSONRPC? where will I see the > > output? > > in case it helps - I know that at least I get the two fields that I sent, > > because the last line (where I name them specifically) works. > > > > On Tue, Nov 9, 2010 at 21:01, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > As a debug check. I'd like to see what you gate if you "print data" > > > before the update. > > > Just in case what you put it in it is not what you get. > > > > > On Nov 9, 1:25 pm, Omri <omri...@gmail.com> wrote: > > > > in the qooxdoo application, I define data as > > > > data = {name: "Prüfung", textfield : "Etwas mit umlaut- üäüöö"} > > > > and then send it through an asynchronous call (using > > > > qx.io.remote.Rpc.callAsync) > > > > > > On Tue, Nov 9, 2010 at 19:42, mdipierro <mdipie...@cs.depaul.edu> > wrote: > > > > > can you print data? What is in data? > > > > > > > On Nov 9, 12:20 pm, Omri <omri...@gmail.com> wrote: > > > > > > I did some tryouts and it seems that the only problem is with the > > > > > > update method, and then only when called through service.jsonrpc. > I > > > > > > created the following model: > > > > > > > > db.define_table("debug_stuff", > > > > > > Field("name", length=100), > > > > > > Field("textfield", "text"), > > > > > > format="%(name)s") > > > > > > > > and defined the following function in the controller (default): > > > > > > > > @service.jsonrpc > > > > > > def debug_umlauts(data): > > > > > > # db["debug_stuff"].insert(**data) # <--- Worked, no > > > problem > > > > > > # db(db["debug_stuff"]["id"] == 2).update(**data) # > <--- > > > Didn't > > > > > > work > > > > > > db(db["debug_stuff"]["id"] == 2).update(name = > data['name'], > > > > > > textfield=data['textfield']) # <--- Worked > > > > > > return "OK update" > > > > > > > > The only line that didn't work was the second one, where I tried > to > > > > > > use the **data for the update method. The problem is that I want > the > > > > > > method to be general, and therefore cannot use the method of the > > > third > > > > > > line to specify for .update what fields I'm updating. > > > > > > > > Thanks, > > > > > > Omri > > > > > > > > On Nov 8, 5:19 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > > > > > Can you try put a u in front of the string u"..." > > > > > > > > > On Nov 8, 5:30 am, Omri <omri...@gmail.com> wrote: > > > > > > > > > > Hello, > > > > > > > > > > I'm having a unicode problem with the DAL. > > > > > > > > > > I'm developing a (mainly) RPC database application with > qooxdoo > > > as JS > > > > > > > > framework and web2py as the webserver. > > > > > > > > > > I have created a fairly generic update_record function which > > > simply > > > > > > > > gets two input variables - a table name and a data dictionary > > > with > > > > > > > > name/value pairs which correspond to the fields of the table. > > > > > > > > My function looks like this: > > > > > > > > > > def update_record(table_name, data): > > > > > > > > db(db[table_name]['id'] == data['id']).update(**data) > > > > > > > > return db(db[table_name]['id'] == > data['id']).select() > > > > > > > > > > My application should work both in English and in German, and > my > > > > > > > > problem is that when I try to update a string value with an > > > Umlaut > > > > > > > > (example - "Überwlad") I get an error: > > > > > > > > "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in > > > > > > > > position..." > > > > > > > > > > I am able to insert records to the database with Umlauts, but > I > > > use a > > > > > > > > different method for the insert. I use the syntax of > .insert(name > > > = > > > > > > > > value, name2 = value2,...). > > > > > > > > > > I tried to encode all the data keys which are unicode objects > > > without > > > > > > > > success, it keeps raising the same error. > > > > > > > > > > Am I missing something here, or is this a bug? And more > > > > > interestingly, > > > > > > > > how can it be solved? > > > > > > > > > > Thanks, > > > > > > > > Omri > > > > >