-
16 Jul 2010 1:58 AM #1
htmlDecode and japanese
htmlDecode and japanese
Hello,
I have a Window with a jsonreader to display data in french, english and japanese from a firebird database
I insert data in Firebird database from an extjs window with PHP. In my database japanese data are in HTML and in my reader i'm using a convert function (htmlDecode) but it seems that htmldecode didn't convert this HTML into japanese character.Code:reader : new Ext.data.JsonReader({ fields: [ {name: 'RUBRIQUE_FR', type:'string'}, {name: 'RUBRIQUE_AN', type: 'string'}, {name: 'RUBRIQUE_JP', type: 'string', convert: function(v){return Ext.util.Format.htmlDecode(v);}}, ] }),
When i use in php :
I have correct japanese but not with Extjs htmlDecodePHP Code:echo html_entity_decode('サイエンス');
I'm using Ext Designer and should i put my *.js into PHP file with setValue instead of Jsonreader with convert ?
Thanks for your help
Tom
-
18 Jul 2010 5:01 AM #2
I found the solution for my problem.
I was looking for a solution on the client-side using convert function in my jsonreader but the solution was server-side.
I add data in the database with an insert query using
and after i use in my php that generate my json for my jsonreaderPHP Code:$larequete = "insert into sous_rubriques (id_sous_rubrique, sous_rubrique_fr, sous_rubrique_an, sous_rubrique_jp, id_rubrique) values (".$lid.", '".utf8_decode($_POST['SOUS_RUBRIQUE_FR'])."', '".utf8_decode($_POST['SOUS_RUBRIQUE_AN'])."', '".mb_convert_encoding($_POST['SOUS_RUBRIQUE_JP'], 'HTML-ENTITIES','UTF-8')."', ".$_POST['lidrub'].")";
PHP Code:$query = "select sr.id_sous_rubrique, sr.sous_rubrique_fr, sr.sous_rubrique_an, sr.sous_rubrique_jp, r.rubrique_fr, sr.id_rubrique from sous_rubriques sr join rubriques r on r.id_rubrique=sr.id_rubrique where sr.id_sous_rubrique=".$_POST['id_sous_rubrique'];
$statement = ibase_query($conn, $query) or die(ibase_errmsg());
while ($row = ibase_fetch_object($statement)) {
$rec['SOUS_RUBRIQUE_FR'] = utf8_encode($row->SOUS_RUBRIQUE_FR);
$rec['SOUS_RUBRIQUE_AN'] = utf8_encode($row->SOUS_RUBRIQUE_AN);
$rec['SOUS_RUBRIQUE_JP'] = mb_convert_encoding($row->SOUS_RUBRIQUE_JP, 'UTF-8','HTML-ENTITIES');
$rec['RUBRIQUE_FR'] = utf8_encode($row->RUBRIQUE_FR);
$rec['ID_RUBRIQUE'] = $row->ID_RUBRIQUE;
$arr[] = $rec;
}
$jsonresult = json_encode($arr);
echo $jsonresult;
Similar Threads
-
MaskRE for DoubleByte Characters (Japanese, Chinese etc.)
By squarefan in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 9 Apr 2009, 10:59 PM -
Editor Grid: problem updating japanese characters with ie
By drif in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 11 Feb 2009, 5:58 PM -
[Need help urgently] Japanese charset does not display in the grid
By nhuyanhuk in forum Ext 2.x: Help & DiscussionReplies: 7Last Post: 12 Jun 2008, 1:57 AM


Reply With Quote