[FX.php List] Solving utf-8 numeric entities problems

Kamezawa Sachiko tpcturtle at gmail.com
Sat Jul 11 03:33:57 MDT 2009


Hi all,

I have been trying to figure out how to obtain FileMaker Pro8/9 field values
not in the form of html numeric entities when you want to get the result in
utf-8 encoding.

For example, if I enter aiueo in Japanese hiragana, I would get
あいうえお in the resulted html source.
Well that is alright when web browsers just show me the characters properly.

However, I have noticed that those numeric entities are shown as they are
when I use CakePHP with FMCakeMix and FX.php.
(FMCakeMix is a full read/write datasource for FileMaker by Alex Gibbons.
http://bakery.cakephp.org/articles/view/fmcakemix-a-full-read-write-datasource-for-filemaker
.)

So I modified FX.php a bit to obtain data in the proper utf-8 format by
using html_entity_decode() function..
The modified function is ElementContents which begins from line 447 in
FX.php.
I am going to paste only the fixed parts here, but you can refer to the line
number so it would not be too hard to locate them.

**** MODIFIED PARTS BEGIN ***

// Line 459
$this->currentData[$this->currentRecord][$this->currentField] .=
html_entity_decode(preg_replace($this->UTF8SpecialChars,
$this->UTF8HTMLEntities, $data),ENT_QUOTES,'UTF-8');

// Line 461
$this->currentData[$this->currentRecord][$this->currentField][$this->currentFieldIndex]
.= html_entity_decode(preg_replace($this->UTF8SpecialChars,
$this->UTF8HTMLEntities, $data),ENT_QUOTES,'UTF-8');

//Line 469
$this->valueLists[$this->currentValueList][$this->currentValueListElement]
.= html_entity_decode(preg_replace($this->UTF8SpecialChars,
$this->UTF8HTMLEntities, $data),ENT_QUOTES,'UTF-8');;

**** MODIFIED PARTS END ***

Ther version of FX.php I am using is 4.5.1.

With this modification, I have been able to see results in cakePHP properly
and
the resulted html source shows the proper characters as well so far.
But I am not so sure what I have done is the right way to do so.  This is
just to show you how I solved this problem with numeric entities.

If there were better ways to solve this problem, I would very much
appreciate them.

Kame
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20090711/4403eb91/attachment-0001.html


More information about the FX.php_List mailing list