R: [phpxmlrpc-devel] proper data encoding in string value
Brought to you by:
ggiunta
From: Gaetano G. <giu...@se...> - 2003-06-09 08:38:51
|
A little while ago I posted to the list a proposal (well, some = questions, rather than a patch, actually) for variable XML encoding. In short: some people might need UTF-8 and some people might need = iso-whatever. Moreover, using default encoding of UTF-8 is not in accordance with = RFC2616 (afaik), so we actually have a problem. (see posting dated = 25/9/02) Instead of just reversing the $xmlrpc_defencoding var, a better solution = would be to make it a property of the client (or message ?) class, so = that it can be switched 'on the fly'. On the other end of the tunnel, xmlrpc servers should be allowed to = decide which encoding they accept. The best option would be of course if = the server could accept more than one encoding, and maybe reply to = messages using the same encoding as received, 'guessing' it by peering = at 1-the HTTP headers, 2-the <?xml> tag. I did not propose an implementation for the above because my = understanding of the xml syntax is too little for point 2 above. As for not transalting stuff inside <string> except for '<' and '&', you = also have to make sure that you're 'translating' chars that are not = valid in the chosen encoding. One little note: php is quite limited in xml encodings supported because = of the underlying xml library (expat). Luckily the next version (php 5) will use by default XML-lib, wich is = much more powerful/advanced in many ways. Gaetano > -----Messaggio originale----- > Da: php...@li... > [mailto:php...@li...]Per conto di maHo > Inviato: domenica 8 giugno 2003 2:40 > A: php...@li... > Oggetto: [phpxmlrpc-devel] proper data encoding in string value >=20 >=20 > there is a problem in encoding string value to xmlrpcval. >=20 > original code uses htmlentities, which converts chars>0x127 > to &someentity; format. this format doesn't stand well > with php xml parser, and disaster is ready, if there is > a must to transfer some letters, ie. from polish alphabet. >=20 > solutions: > 1)the xmlrpc spec says that only '<' and '&' characters > need to be translated to entities. > so strtr($body,array("<"=3D>"<,"&"=3D>"&")) instead of > htmlentities($body) is better IMHO. >=20 > 2)changing default encoding from "UTF-8" to > "iso-8859-1" helps a lot. I don't know why, it's very strange, (as=20 > strange is fact,that php provides only iso8859-1 and utf8 encodings) > but with mentioned changes, you can transfer all data, even binary, > as xmlrpc string. >=20 > i've posted the proper patch at >=20 > http://sourceforge.net/tracker/download.php?group_id=3D34455&ati d=3D411302&file_id=3D52440&aid=3D750764 pozdrav maHo --=20 lukasz shift-2 mach.com.pl,http://www.lukasz.mach.com.pl=09 gg://1612670 jabber://ma...@ja... jabber://ma...@ja... icq://136281200 motto://"nie dziel skarbu p=F3ki smok zipie" ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ phpxmlrpc-devel mailing list php...@li... https://lists.sourceforge.net/lists/listinfo/phpxmlrpc-devel |