Cannot update data when data in ID field is non-ascii

Hi,
I encounter a problem when trying to update data using Form, Connector, and DataProcessor.
I set up the page very similar to this tutorial docs.dhtmlx.com/doku.php?id=tuto … htmlxstart

The page update data without any problem if the ID field is an ASCII character. But, the problem occurs when the ID field is a non-ASCII character (in Thai).

The content of the connector php file is:

require_once("../codebase/connector/form_connector.php");
$res=mysql_connect($db_host,$db_user,$db_passwd);
mysql_select_db($db_name);
mysql_set_charset('utf8',$res);
$formConn = new FormConnector($res,"MySQL");
$formConn->set_encoding("utf-8");
$formConn->enable_log("formConn.log");
$formConn->render_table($sTable,$sField,$sList);
//$formConn->render_sql($sSQL,$sField,$sList);

It doesn’t matter if I use the render_table() or render_sql(). The results are the same.

I captured the POST request issued after the dpf.sendData() is invoked. The POST requests are:

  1. If the ID field is an ASCII character, the POST request is:
    S_!nativeeditor_status: updated
    S_VATrate: 0.1
    S_companyName: [some data in Thai]
    S_idCompany: S
    S_shortName: [some data in Thai]
    ids: S
S_idCompany=S&S_companyName=%E0%B8%AB%E0%B8%A3%E0%B8%A3%E0%B8%A9%E0%B8%B2%20%E0%B8%A1%E0%B8%B2%E0%B8%A3%E0%B9%8C%E0%B9%80%E0%B8%81%E0%B9%87%E0%B8%95%E0%B8%95%E0%B8%B4%E0%B9%89%E0%B8%87&S_shortName=%E0%B8%AB%E0%B8%A3%E0%B8%A3%E0%B8%A9%E0%B8%B2&S_VATrate=0.1&S_!nativeeditor_status=updated&ids=S
  1. If the ID field is a non-ASCII character, the POST request is:
    _!nativeeditor_status: updated
    _VATrate: 0.1
    _companyName: [some data in Thai]
    _idCompany: ห (This is the correct ID character)
    _shortName: [some data in Thai]
    ids: [nothing here]
_idCompany=%E0%B8%AB&_companyName=%E0%B9%84%E0%B8%AB%E0%B8%AA%E0%B8%B2&_shortName=%E0%B8%AB%E0%B8%81%E0%B8%94&_VATrate=0.1&_!nativeeditor_status=updated&ids=

I’ve spend hours digging into the dataprocessor.php and other files and changed some code. But, I don’t have any luck getting it to work. Please help.

Try to update dataprocessor.js with the attached one
If it still doesn’t work - please provide any kind of sample where problem can be checked.
dhtmlxdataprocessor.zip (4.98 KB)

Thank you for the updated file. I tried with the attached files. The results are the same with the official release. I also unable to ‘update’ any recode if the data in the ID field contain any non-ascii character.

Please use ‘data.sql’ to create the testing database.
test.zip (849 KB)

I think I found a solution.
The problem come from the match() function on the line 2481 in dhtmlxform.js. The line is in dhtmlxAjax.get inside the dhtmlxForm.prototype.load function.

The lines are:

var id = url.match(/(\?|\&)id\=([a-z0-9_]*)/i); if (id && id[0]) id = id[0].split("=")[1];
The url variable is given as “xml/company_details.php?id=ซ”

After these three lines, the id variable should be id=[“ซ”]. But, because the match function, the id = [""]. It solve my problem when I modified RegExp in the match() to match(/(?|&)id=([a-z0-9ก-๛_]*)/i). The additional characters only work for Thai language only. You will need to modify the RegExp for other language as well.

Problem confirmed, we will update code in next version to resolve such kind of problems.