RE: Query2XML & utf8 databases
| From: | Lukas Feiler | Date: | Sun, 15 Apr 2007 15:35:06 +0000 |
| Subject: | RE: Query2XML & utf8 databases | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-46221@lists.php.net to get a copy of this message | ||
Hi,
> Lukas Feiler wrote:
>
> 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.
> >
>
The new 'encoder' option introduced in the new release v1.2.0 allows you to
handle UTF-8 databases.
Please see the manual [1] for further details on this.
It's now also possible to use something else than UTF-8 for XML encoding.
[2]
Cheers,
Lukas
[1]
http://query2xml.sf.net/docs/html/XML_Query2XML/tutorial_XML_Query2XML.pkg.h
tml#query2xml_getxml.options_encoder.disabling
[2]
http://query2xml.sf.net/docs/html/XML_Query2XML/tutorial_XML_Query2XML.pkg.h
tml#encoding