UTF-8 encoding and dhtmlXgrid


I’ve just started to play around with dhtmlXgrid and like what I see. I’ve got one question though. I’ve got a utf-8 encoded database conected; serve my webpages as utf-8 on a utf-8 webserver.

So I was hoping I could enter data like: ěščřžýúů (Tsjech) into the grid and get those values stored in the database.

Problem is the data is inserted as: %u011B%u0161%u010D%u0159%u017Eýú%u016F into the database. So when I retrieve this data again, the value in the grid is like how it was inserted in the database.

Is there a way to let the characters travel to the DB the way they were entered?

There are two types of escaping can be done on client side. The currenly used “escape” convert them to %u011B%u0161%u010D%u0159%u017Eýú%u016F which can’t be recognized by some server side platforms.

You can try to replace all occurences of “escape” in dhtmlxDataProcessor.js with “encodeURI” - this is another encoding routine, which will not convert UTF characters.
( such functionality will be available as method of dataProcessor in one of next dhtmlxGrid’s build )

FYI, This solution only half works but if any of the cells contain an
ampersand character then the post/get data gets messed up because the
& symbol is not escaped.

A better solution is to use the encodeURIComponent() function instead, it escapes the
following characters: , / ? : @ & = + $ and works with UTF8 characters.