Forum


09:06

13/11/2009

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
09:10

13/11/2009

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);
22:32

13/11/2009

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 !
01:42

Moderators
08/10/2009

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
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66