Special Character Encoding

QuestionsSpecial Character Encoding
Tony Wai asked 5 years ago

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

PHPGrid – Charset Encode

1 Answers
Abu Ghufran Staff answered 5 years ago

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)

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

11 + 3 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?