Re: [PHP] HTML equivalents of accented characters
"Liam Gibbs" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I think php.net/htmlentities will do this. > > Apparently it *is*, but it won't for me. Any problems with this code? > > $result[] = "é"; > $result[1] = htmlspecialchars($result[0]); > $result[2] = htmlentities($result[0]); > > Both return the accented E unchanged. I bet they do, did you check the HTML source as well? My guess is that the source is reading the actual expected output, but your browser views "é", as it should of course. HTH, -- Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML equivalents of accented characters
http://hotwired.lycos.com/webmonkey/reference/special_characters/ should have all you want From: "Liam Gibbs" <[EMAIL PROTECTED]> To: "php list" <[EMAIL PROTECTED]> Subject: [PHP] HTML equivalents of accented characters Date: Mon, 11 Aug 2003 14:18:37 -0400 I don't think this has been discussed, although I'm not really sure what you would call these accented characters, so I haven't been able to do a complete search of the archives, so apologies if this has been previously discussed. Is there a function that not only turns & into &, " into ", and the like, but also turns é into é and likewise with other accented characters? I know I could easily write one, but why if one already exists? _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML equivalents of accented characters
> I have no idea what might be the problem, what does your translation table > look like? Mine is still coming out as a single character. Here's my code, in case anyone can spot any stupid human error blunder I'm making: $translationtable = get_html_translation_table(HTML_ENTITIES); $string = htmlspecialchars($string); Also, here's my setup, just in case: PHP 4.3.1 Linux 2.2.19 #1 i586 Apache 1.3.27 MySQL 3.23.49 (don't know what this has to do with it, but just in case there has been some interference with PHP and MySQL) GD 2.0 compatible -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML equivalents of accented characters
> I bet they do, did you check the HTML source as well? My guess is that the > source is reading the actual expected output, but your browser views "é", as > it should of course. Sorry, should have mentioned. The source code reads the actual character, not the é. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML equivalents of accented characters
> I think php.net/htmlentities will do this. Apparently it *is*, but it won't for me. Any problems with this code? $result[] = "é"; $result[1] = htmlspecialchars($result[0]); $result[2] = htmlentities($result[0]); Both return the accented E unchanged. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML equivalents of accented characters
I think php.net/htmlentities will do this. On Monday 11 August 2003 11:18 am, Liam Gibbs wrote: > I don't think this has been discussed, although I'm not really sure what > you would call these accented characters, so I haven't been able to do a > complete search of the archives, so apologies if this has been previously > discussed. > > Is there a function that not only turns & into &, " into ", and > the like, but also turns é into é and likewise with other accented > characters? I know I could easily write one, but why if one already exists? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML equivalents of accented characters
Hello, This is a reply to an e-mail that you wrote on Mon, 11 Aug 2003 at 19:18, lines prefixed by '>' were originally written by you. > I don't think this has been discussed, although I'm not really sure > what you would call these accented characters, so I haven't been able > to do a complete search of the archives, so apologies if this has been > previously discussed. > Is there a function that not only turns & into &, " into ", > and the like, but also turns é into é and likewise with other > accented characters? I know I could easily write one, but why if one > already exists? echo htmlentities("é"); // outputs é See http://php.net/htmlentities David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML equivalents of accented characters
"Liam Gibbs" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I bet they do, did you check the HTML source as well? My guess is that the > > source is reading the actual expected output, but your browser views "é", > as > > it should of course. > Sorry, should have mentioned. The source code reads the actual character, > not the é. Hmmm... interesting... I tested your exact code in this format : which returned (sourcecode) [é][é][é] So with me, htmlentities works. Did you try this : $a = get_html_translation_table(HTML_ENTITIES); var_dump($a); ? With me, it returns a 99 elements array with loads of characters, including the "é". (PHP/4.2.3 on Win2000) I have no idea what might be the problem, what does your translation table look like? -- Ivo Fokkema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML equivalents of accented characters
To change "é" to "é" you need htmlentities(), not htmlspecialchars as the latter only translates ampersands (&), double quotes, less than en greater than characters (Single quotes are not translated by default). If htmlentities does not work, what does a var_dump on your $translationtable send back? Ivo "Liam Gibbs" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I have no idea what might be the problem, what does your translation table > > look like? > > Mine is still coming out as a single character. Here's my code, in case > anyone can spot any stupid human error blunder I'm making: > > $translationtable = get_html_translation_table(HTML_ENTITIES); > $string = htmlspecialchars($string); > > Also, here's my setup, just in case: > PHP 4.3.1 > Linux 2.2.19 #1 i586 > Apache 1.3.27 > MySQL 3.23.49 (don't know what this has to do with it, but just in case > there has been some interference with PHP and MySQL) > GD 2.0 compatible > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML equivalents of accented characters
I don't think this has been discussed, although I'm not really sure what you would call these accented characters, so I haven't been able to do a complete search of the archives, so apologies if this has been previously discussed. Is there a function that not only turns & into &, " into ", and the like, but also turns é into é and likewise with other accented characters? I know I could easily write one, but why if one already exists?