RE: Query2XML & utf8 databases
| From: | Lukas Feiler | Date: | Tue, 10 Apr 2007 22:10:35 +0000 |
| Subject: | RE: Query2XML & utf8 databases | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-46186@lists.php.net to get a copy of this message | ||
Hi Mickaël!
Please CC all mails to pear-dev@lists.php.net
Mickaël Guérin wrote:
>
> Hi Lucas,
>
> I'm a user of Query2XML and I'm experiencing some
> difficulties : there's
> no way to tell Query2XML if datas need to be 'utf8_encoded' or not.
> Is it on your TODO list ?
If I'm understanding you correctly, you mean that the data in your database
already is UTF-8-encoded and therefore XML_Query2XML::_utf8encode() should
not be called.
There are two solutions to this problem (that all require a new release):
1) make XML_Query2XML::_utf8encode() protected (instead of private) so that
it can be overwritten by sub-classes; this is OO style
2) create a new option named 'encoder' that can be specified on every level
and allows you to overwrite the default of XML_Query2XML::_utf8encode() -
this would work like $options['mapper'] [1]
I prefer the second solution as it gives the developer the possibility to
use different encoding functions for different levels, i.e. for different
tables. What's your opinion?
This has been sitting on my todo-list for quite some time now; so thanks for
bringing it up!
>
> I've looked at the code, and the only consequence of
> implementing such a
> feature would be to remove the 'static' attribute of some methods.
> Let me know if you plan to implement this, else I would patch
> Query2XML
> (and send you a patch of course ;) ).
>
> Mickaël.
>
Cheers,
Lukas
[1]
http://query2xml.sf.net/docs/html/XML_Query2XML/tutorial_XML_Query2XML.pkg.h
tml#query2xml_getxml.options_mapper