From: Mici M. <mm...@fr...> - 2006-08-14 16:56:46
|
Hi, I tried to set the CHARSET in the config.ini to 1) utf-8=20 2) iso-8859-2 The 1) gone wrong because of a failed sql select. [There's a mysql in the background.] the sql query string should not contain utf encoded characters. The number 2) was wrong because htmlspecialchars... So I wrote a htmlspecialchars_workaround() function, that checks the third argument (which is the requested charset), and if it's 8859-2, it makes a few simple string replacement. [<, > and & is enough to replace to "<", ">" and "&"...] It calls the original htmlspecialchars in other cases. Now I can use iso-8859-2 in the config.ini, and Wiki seems to work. Of course I have had to append _workaround to all occurances os htmlspecialchars in the original code. Brrrr! Ugly and impossible to maintenance but maybe works... It's under testing now. 8-) Why don't use PhpWiki developers their own html escaper function?? htmlspecialchars() has more disadvatages than advantages, because it keeps the usable character set small, so excludes lots of people from lots of nations to join the project... mm. Reini Urban <ru...@x-...> =EDrta: > Reini Urban schrieb: > > Mici Maci schrieb: > >> thanks for your answer but it's not so easy. PhpWiki > >> uses htmlspecialchars() to masq strings, and PhpWiki > >> passes a third argument to it containing the charset > >> name. htmlspecialchars() does not know about latin2, > >> it gives warnings. > >> > >> lib/XmlElement.php...: 502: Warning: htmlspecialchars(): > >> charset `iso-8859-2' not supported, assuming iso-8859-1 > >> > >> lib/XmlElement.php...: 170: Warning: htmlspecialchars(): > >> charset `iso-8859-2' not supported, assuming iso-8859-1 > >> > >> These two lines (502 and 170) are giving the message > >> but lots of times in a page request. What's wrong? May > >> I upgrade or reconfigure php to work, or the > >> htmlspecialchars() function needs a workaround in > >> PhpWiki? > >> > >> [phpwiki-1.3.12p3] > >> [php-4.4.2-1.1] > >=20 > > Oje! > > http://www.mantisbt.org/mantis/bug_view_page.php?bug_id=3D6624 > >=20 > > So you have to convert to UTF-8 and bite into the bullet. > > Note, that UTF-8 is not officially supported and not included. > >=20 > > I posted a patch to the sf.net patch area, which should get around most=20 > > issues. But since UTF-8 strings are asciiz-safe it is not so harmful to=20 > > work without proper UTF-8 support in all string functions. (preg_match,=20 > > strlen, ...) >=20 > BTW: If you do have mbstring loaded in your php it's very easy. > Simply set > mb_internal_encoding('UTF-8'); > somewhere ("lib/config.ini") and set >=20 > mbstring.func_overload in the php.ini or .htaccess to 7 >=20 > .htaccess: > php_value mbstring.func_overload 7 >=20 > The hugepatch comes from the fact, that not all servers support mbstring=20 > and strlen's are different in UTF-8 land. > We do support now, input from UTF-8 land (e.g. MS IE), but convert this=20 > input to our charset. > --=20 > Reini Urban > http://phpwiki.org/ http://murbreak.at/ > http://helsinki.at/ http://spacemovie.mur.at/ >=20 > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1= 21642 > _______________________________________________ > Phpwiki-talk mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwiki-talk > =0A=0A________________________________________________________________ Iratkozzon fel szakmai h=EDrlevel=FCnkre =E9s nyerje meg =D6n a 3 db k=E9ny= eztet=F5 wellness h=E9tv=E9ge egyik=E9t! kattintson ide: http://www.dashofer.hu/origo/?wa=3DCEMORI0632 |