Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
How to display Chinese character in the grid?
13/11/2009
09:06
Avatar
markthien
Member
Members
Forum Posts: 5
Member Since:
13/11/2009
sp_UserOfflineSmall Offline

Hi guys,

    I was using json to grab data from mysql and able to display the Chinese characters in a common table. However, now I changed to use jqgrid, all the Chinese character garble. Appreciate any help please. My code is like below:

      $("#list").jqGrid({
        url:'bin/get-inbox.php?q=2',
        datatype: 'json',
        mtype: 'GET',
        colNames:['Id','Date','Mobile', 'Message'],
        colModel :[
          {name:'id', index:'id', width:100, hidden:true},
          {name:'date_created', index:'date_created', width:180},
          {name:'mobile_num', index:'mobile_num', width:120},
          {name:'message', index:'message', width:880}
        ],
        imgpath: gridimgpath,
        pager: '#pager',
        rowNum:20,
        rowList:[20,40,60],
        sortname: 'date_created',
        sortorder: 'desc',
        viewrecords: true,
        height:440,
        pginput:false
      }).navGrid('#pager',{edit:false,add:false,del:false,search:false,refresh:true});

thanks & regards,

Mark Thien

13/11/2009
09:10
Avatar
markthien
Member
Members
Forum Posts: 5
Member Since:
13/11/2009
sp_UserOfflineSmall Offline

my php code is like below:

$SQL = "SELECT id, date_created, mobile_num, message FROM inbound_message ORDER BY $sidx $sord LIMIT $start , $limit";
$result = mysql_query( $SQL ) or die("Couldn't execute query.".mysql_error());

$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$i=0;

while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
    $responce->rows[$i]['id']=$row['id'];
    $responce->rows[$i]['cell']=array($row['id'],$row['date_created'],$row['mobile_num'],$row['message']);
    $i++;
}

echo json_encode($responce);

13/11/2009
10:00
Avatar
markthien
Member
Members
Forum Posts: 5
Member Since:
13/11/2009
sp_UserOfflineSmall Offline

sorry double post accidentally

13/11/2009
22:32
Avatar
markthien
Member
Members
Forum Posts: 5
Member Since:
13/11/2009
sp_UserOfflineSmall Offline

Hi guys,

    Sorry it's my mistake.I forgot to set execute the query below:

// set the query the UTF8 first
$SQL = 'SET character_set_results=utf8';
$result = mysql_query( $SQL ) or die("Couldn't execute query.".mysql_error());

// then your query below

mysql_close();

hope this help someone out there on the Earth !

14/11/2009
01:42
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

Hello,

There is a similar forum topic on this here:

http://www.trirand.com/blog/?p.....e-wordutf8

Basically the idea is to make sure all your data and HTML pages come in UTF-8 format. This way the grid will be able to display the data correctly. This may include setting the response to:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

I have one question - we seem to be missing Chinese localization in our install package, can
you please send us you Chinese localization of the grid locales? (mail to rumen.stankov at trirand dot net)

Thanks a lot.

Kind Regards,
Rumen
Trirand Inc

Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller

http://www.trirand.net

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
70 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information