Hello,
I am evaluating a Grid function library which can help me to display my data correctly on a web page. I do not need to modify or insert the original data stored in the mysql database.
However I run into a trouble with the Chinese Double Byte Character Set (Big5).
Original Text in Chinese Character: “公司簡稱” . Displayed on the Web page: “¤½¥q¦WºÙ”
As the Chinese text stored in the mysql database is generated by a very old program, the charset encode is not correct. In order to read and display the data correctly, I have to decode the character two times using the following convert_encoding function.
function my_convert_encoding($text_in) {
$text_out = mb_convert_encoding($text_in, “WINDOWS-1252″,”utf-8″);
$text_out = mb_convert_encoding($text_out,”utf-8”, “big5” );
return $text_out;
}
I would like to know how I can embed such modification.
Attached the snapshot
You can use data display filter to pass all content from your callback and do encoding there.
Callback events are currently supported in full version. If you want to evaluate it before purchase you can drop me an email at [email protected]
Sample Code:
$e[“on_data_display”] = array(“filter_display”, null, true);
$grid->set_events($e);
function filter_display($data)
{
foreach($data[“params”] as &$d)
{
foreach($d as $k=>$v)
$d[$k] = my_convert_encoding($d[$k]);
}
}
Actual Demo: https://phpgrid.org/demo/demos/editing/custom-events.php
Code: https://phpgrid.org/demo/demos/editing/custom-events.phps (line 51)