Re: [PHP] htmlentities

2011-09-13 Thread Marc Guay
You could store the accented characters in your DB if you set everything to UTF-8, including calling the "SET NAMES utf8" MySQL command after connecting. I find this much easier than encoding/decoding. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.

[PHP] htmlentities

2011-09-13 Thread Ron Piggott
Is there a way to only change accented characters and not HTML (Example: ) The syntax echo htmlentities( stripslashes(mysql_result($whats_new_result,0,"message")) ) . "\r\n"; is doing everything (as I expect). I store breaking news within the database as HTML formatted text. I am tryin

Re: [PHP] htmlentities is incomplete: does not cover rsquo etc

2009-03-14 Thread mike
On Sat, Mar 14, 2009 at 12:18 AM, Lester Caine wrote: > This probably one of the reasons some of us think that getting a stable PHP6 > based on unicode out of the door would probably be a lot more use to people > than PHP5.3 ;) +1 I cannot wait for full unicode. mbstring, iconv, all this wacky

Re: [PHP] htmlentities is incomplete: does not cover rsquo etc

2009-03-14 Thread Lester Caine
Heddon's Gate Hotel wrote: Thanks Jan, it's much clearer now. My knowledge about character encodings has multiplied 100-fold in the last 24 hours' research. Would it be a good idea for the PHP Manual to address some of these issues, by explaining good practice in encoding arbitrary user input

Re: [PHP] htmlentities is incomplete: does not cover rsquo etc

2009-03-13 Thread Heddon's Gate Hotel
Thanks Jan, it's much clearer now. My knowledge about character encodings has multiplied 100-fold in the last 24 hours' research. Would it be a good idea for the PHP Manual to address some of these issues, by explaining good practice in encoding arbitrary user input in forms (for example), fo

Re: [PHP] htmlentities is incomplete: does not cover rsquo etc

2009-03-13 Thread Jan G.B.
2009/3/13 Heddon's Gate Hotel : > The string function htmlentities seems to have very incomplete coverage of > the HTML entities listed in the HTML 4 spec.  For example, it does not know > about rsquo, lsquo, rdquo, ldquo, etc.  This is confirmed by looking at the > output of get_html_translation_t

[PHP] htmlentities is incomplete: does not cover rsquo etc

2009-03-12 Thread Heddon's Gate Hotel
The string function htmlentities seems to have very incomplete coverage of the HTML entities listed in the HTML 4 spec. For example, it does not know about rsquo, lsquo, rdquo, ldquo, etc. This is confirmed by looking at the output of get_html_translation_table, which does not list these enti

Re: [PHP] HTMLEntities as NUMERIC for XML

2008-11-25 Thread ceo
> I came across a similar problem using an AJAX thing, with MSWord > characters in the text. The way round the problem was to enclose > everything inside CDATA blocks, which made the browsers happy to > receive as the entities only had to be understood by the HTML browser > now, not the XML pa

RE: [PHP] HTMLEntities as NUMERIC for XML

2008-11-25 Thread Boyd, Todd M.
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 25, 2008 11:28 AM > To: php-general@lists.php.net > Subject: Re: [PHP] HTMLEntities as NUMERIC for XML > > > > I came across a similar problem using

[PHP] HTMLEntities as NUMERIC for XML

2008-11-25 Thread ceo
After reading this: http://validator.w3.org/feed/docs/error/UndefinedNamedEntity.html (all praise W3.org!) I am searching for a PHP library function that will convert all my &abc; into { I have a zillion of these things from converting stupid MS Word characters into something that will,

[PHP] htmlentities() and default_charset

2008-11-08 Thread Jim Hermann - UUN Hostmaster
Folks, Why should htmlentities() use the default_charset for $charset with this example, taken from ext/standard/tests/strings/htmlentities10.phpt? The test script expects the output to be: string(28) "‚†™Ÿ" According to the PHP Manual, the htmlentities() syntax is: string htmlentities ( str

Re: [PHP] htmlentities() does not remove escape

2008-01-28 Thread Richard Lynch
On Sun, January 27, 2008 12:27 pm, jekillen wrote: > Hello: > I have a form that has a textarea and I do not want to > disallow the use of single quote as apostrophe, or > for any other normal stylization. So I am using html > entities to change these characters into html entities. > But the functi

Re: [PHP] htmlentities() does not remove escape

2008-01-27 Thread jekillen
On Jan 27, 2008, at 10:37 AM, Nathan Nobbe wrote: On Jan 27, 2008 1:27 PM, jekillen <[EMAIL PROTECTED]> wrote: I have a form that has a textarea and I do not want to disallow the use of single quote as apostrophe, or for any other normal stylization. So I am using html entities to change thes

Re: [PHP] htmlentities() does not remove escape

2008-01-27 Thread Robert Cummings
On Sun, 2008-01-27 at 10:27 -0800, jekillen wrote: > Hello: > I have a form that has a textarea and I do not want to > disallow the use of single quote as apostrophe, or > for any other normal stylization. So I am using html > entities to change these characters into html entities. > But the funct

Re: [PHP] htmlentities() does not remove escape

2008-01-27 Thread Nathan Nobbe
On Jan 27, 2008 1:27 PM, jekillen <[EMAIL PROTECTED]> wrote: > Hello: > I have a form that has a textarea and I do not want to > disallow the use of single quote as apostrophe, or > for any other normal stylization. So I am using html > entities to change these characters into html entities. > But

[PHP] htmlentities() does not remove escape

2008-01-27 Thread jekillen
Hello: I have a form that has a textarea and I do not want to disallow the use of single quote as apostrophe, or for any other normal stylization. So I am using html entities to change these characters into html entities. But the function does not remove the escapes added by the browser when sendi

Re: [PHP] htmlentities()

2007-11-17 Thread Jim Lucas
Ronald Wiplinger wrote: I tried to understand htmlentities by putting this code into a test.php: Test of evil input "; $field2=htmlentities($field1,ENT_QUOTES,UTF-8); echo "field2=$field2"; you are echo'ing the same field1 variable as before. by your comments at the bottom of what you

Re: [PHP] htmlentities()

2007-11-17 Thread Casey
It is doing that ;) If you look at the source, you will see the expected output. On Nov 17, 2007, at 4:41 AM, Ronald Wiplinger <[EMAIL PROTECTED]> wrote: I tried to understand htmlentities by putting this code into a test.php: Test of evil input "; $field2=htmlentities($field1,EN

Re: [PHP] htmlentities()

2007-11-17 Thread Ludovic André
Hi, I tried to understand htmlentities by putting this code into a test.php: [...] The output on the screen is: field1=*Greater input and lower input* field2=Greater input and lower input Greater input and lower input A 'quote' is bold A 'quote' is bold I expected that it would give me in

[PHP] htmlentities()

2007-11-17 Thread Ronald Wiplinger
I tried to understand htmlentities by putting this code into a test.php: Test of evil input "; $field2=htmlentities($field1,ENT_QUOTES,UTF-8); echo "field2=$field2"; echo htmlentities($field1,ENT_QUOTES,UTF-8); echo ""; $str = "A 'quote' is bold"; // Outputs: A 'quote' is bold ec

Re: [PHP] Htmlentities vs htmlspecialchars

2006-07-26 Thread Michael Rasmussen
On Wed, 26 Jul 2006 14:59:46 +0200, Jochem Maas wrote: > > I wonder if anyone can given a solid answer to this? If I remember correctly, htmlspecialchars does what its name indicate: konvert any character with special meaning according to the HTML specification. htmlentities converts any characte

Re: [PHP] Htmlentities vs htmlspecialchars

2006-07-26 Thread Jochem Maas
Dave Goodchild wrote: > Hi all. I know htmlspecialchars converts the smallest set of entities > possible to generate valid HTML, and that htmlentities goes much > further, so > what is the difference? Is it not better to use htmlentities in every case, > making htmlspecialchars somewhat redundant,

[PHP] Htmlentities vs htmlspecialchars

2006-07-26 Thread Dave Goodchild
Hi all. I know htmlspecialchars converts the smallest set of entities possible to generate valid HTML, and that htmlentities goes much further, so what is the difference? Is it not better to use htmlentities in every case, making htmlspecialchars somewhat redundant, or is there a performance trade

Re: [PHP] htmlentities() with utf8

2006-05-08 Thread Eric Butera
On 5/4/06, Marten Lehmann <[EMAIL PROTECTED]> wrote: Hello, I want to use htmlentities() with UTF-8, which I can set with the third parameter. But to use the third parameter, I have to provide the second parameter. Currently the default for the second parameter is ENT_COMPAT. But as this might c

Re: [PHP] htmlentities() with utf8

2006-05-04 Thread Chris
Marten Lehmann wrote: Hello, I want to use htmlentities() with UTF-8, which I can set with the third parameter. But to use the third parameter, I have to provide the second parameter. Currently the default for the second parameter is ENT_COMPAT. But as this might change, I don't want to call

Re: [PHP] htmlentities() with utf8

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 11:02 am, Marten Lehmann wrote: > I want to use htmlentities() with UTF-8, which I can set with the > third > parameter. But to use the third parameter, I have to provide the > second > parameter. Currently the default for the second parameter is > ENT_COMPAT. > But as this migh

[PHP] htmlentities() with utf8

2006-05-04 Thread Marten Lehmann
Hello, I want to use htmlentities() with UTF-8, which I can set with the third parameter. But to use the third parameter, I have to provide the second parameter. Currently the default for the second parameter is ENT_COMPAT. But as this might change, I don't want to call htmlentities with htm

Re: [PHP] htmlentities()

2004-09-08 Thread Anthony Ritter
Chris Shiflett wrote: > View source, and I think you'll understand. Or, remove the call to > htmlentities(). > > Chris .. Thank you all for your assistance. Best... TR ... "...when a browser sees <, it prints out a < character instead of thinking "OK here comes an HTML tag.

Re: [PHP] htmlentities()

2004-09-08 Thread Jim Grill
> Copied and pasted the following sample script from the php manual and this > outputs: > > ... > $str = "A 'quote' is bold"; > echo htmlentities($str); > > ?> > .. > > // outputs: A 'quote' is bold > > Not sure why the I am still getting the tags and spaces after the call to >

Re: [PHP] htmlentities()

2004-09-08 Thread Jim Grill
> Copied and pasted the following sample script from the php manual and this > outputs: > > ... > $str = "A 'quote' is bold"; > echo htmlentities($str); > > ?> > .. > > // outputs: A 'quote' is bold > > Not sure why the I am still getting the tags and spaces after the call to >

Re: [PHP] htmlentities()

2004-09-08 Thread Chris Shiflett
--- Anthony Ritter <[EMAIL PROTECTED]> wrote: > Copied and pasted the following sample script from the php manual > and this outputs: > > ... > $str = "A 'quote' is bold"; > echo htmlentities($str); > > ?> > .. > > // outputs: A 'quote' is bold > > Not sure why the I am sti

[PHP] htmlentities()

2004-09-08 Thread Anthony Ritter
Copied and pasted the following sample script from the php manual and this outputs: ... bold"; echo htmlentities($str); ?> .. // outputs: A 'quote' is bold Not sure why the I am still getting the tags and spaces after the call to htmlentities(). Thank you for any help. TR

[PHP] htmlentities and foreign characters from MS Word

2004-09-04 Thread Monty
I'm having a problem figuring out how to deal with foreign characters in text that was copied from an MS Word document and pasted into a form field. I'm not how sure this is getting stored in the MySQL database, but, when I run htmlentities() on this text, each foreign character is converted into

[PHP] htmlentities, links, javascript

2004-04-12 Thread Beau Hartshorne
hi all, i have a script that calls a popup like this: Choices the & is there to make sure the page validates. the problem is that some browsers seem to be incorrectly translating this to: [REQUEST_URI] => /popup.php?name=Choices&product_id=15 instead of: [REQUEST_URI] => /popup.php?name=Choic

Re: [PHP] htmlentities -- can it skip tags

2003-09-14 Thread Justin French
On Monday, September 15, 2003, at 12:58 PM, John W. Holmes wrote: Justin French wrote: Hi all, I need to convert some text from a database for presentation on screen... as per usual, characters like quotes and ampersands (&) are giving me grief. the obvious answer is to apply htmlspecialchars

Re: [PHP] htmlentities -- can it skip tags

2003-09-14 Thread Justin French
On Monday, September 15, 2003, at 12:58 PM, John W. Holmes wrote: Justin French wrote: Hi all, I need to convert some text from a database for presentation on screen... as per usual, characters like quotes and ampersands (&) are giving me grief. the obvious answer is to apply htmlspecialchars

Re: [PHP] htmlentities -- can it skip tags

2003-09-14 Thread John W. Holmes
Justin French wrote: Hi all, I need to convert some text from a database for presentation on screen... as per usual, characters like quotes and ampersands (&) are giving me grief. the obvious answer is to apply htmlspecialchars(), BUT this also converts all < and > into < and > signs, which d

[PHP] htmlentities -- can it skip tags

2003-09-14 Thread Justin French
Hi all, I need to convert some text from a database for presentation on screen... as per usual, characters like quotes and ampersands (&) are giving me grief. the obvious answer is to apply htmlspecialchars(), BUT this also converts all < and > into < and > signs, which destroys the html mark

Re: [PHP] htmlentities() and the macintosh character set

2003-09-13 Thread Eugene Lee
On Sat, Sep 13, 2003 at 11:24:56AM -0700, Michael Winston wrote: : : The request: Can the macintosh character set be added as an option for : htmlentities() and other commands? That would be so helpful for our : mac-based company. : : The problem: I'm fairly new to php and have found that th

[PHP] htmlentities() and the macintosh character set

2003-09-13 Thread Michael Winston
Hello- I have a request but don't know where to send it. Thus, it ends up here. Alternately, I'm looking for some solutions: The request: Can the macintosh character set be added as an option for htmlentities() and other commands? That would be so helpful for our mac-based company. The pr

[PHP] htmlentities()

2003-02-27 Thread Liam Gibbs
I seem to be having trouble with htmlentities(). Maybe someone has a clue I can borrow. Here's my function: function FitForHTML($string) { $asciitable = get_html_translation_table(HTML_ENTITIES); $string = htmlentities($string, ENT_COMPAT); $string = str_replace($asciitable[chr(255)],

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
On Saturday 28 September 2002 09:13 pm, John W. Holmes wrote: > > -Original Message- > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, September 28, 2002 9:14 PM > > To: [EMAIL PROTECTED]; 'Sascha Cunz'; [EMAIL PROTECTED] > > Subj

RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes
> -Original Message- > From: Andre Dubuc [mailto:[EMAIL PROTECTED]] > Sent: Saturday, September 28, 2002 9:14 PM > To: [EMAIL PROTECTED]; 'Sascha Cunz'; [EMAIL PROTECTED] > Subject: Re: [PHP] Htmlentities and Newlines? > > On Saturday 28 September 2002

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
On Saturday 28 September 2002 08:59 pm, John W. Holmes wrote: > > -Original Message- > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, September 28, 2002 9:00 PM > > To: [EMAIL PROTECTED]; 'Sascha Cunz'; [EMAIL PROTECTED] > > Subj

RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes
> -Original Message- > From: Andre Dubuc [mailto:[EMAIL PROTECTED]] > Sent: Saturday, September 28, 2002 9:00 PM > To: [EMAIL PROTECTED]; 'Sascha Cunz'; [EMAIL PROTECTED] > Subject: Re: [PHP] Htmlentities and Newlines? > > On Saturday 28 September 2002

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Sascha Cunz
> Does PHP do what? By default the MySQL query function can only take one > query at a time. There is nothing strange about this. The command-line > mysql tool can take multiple queries separated by semi-colons, but that is > something that is implemented in that command-line tool. It is not d

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
On Saturday 28 September 2002 08:42 pm, John W. Holmes wrote: > > Short question: following your advice, what would the data look like > > in > > > the > > db if I typed in: > > > > Hi Sascha. > > Next line is doubled. > > > > Double. > > > > How would that appear iun the db? In mine,

RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes
> Short question: following your advice, what would the data look like in > the > db if I typed in: > > Hi Sascha. > Next line is doubled. > > Double. > > How would that appear iun the db? In mine, it looks exactly like I typed > it > above (using 1 & 2 with magic_quotes=on).

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
On Saturday 28 September 2002 08:32 pm, John W. Holmes wrote: > > -Original Message- > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, September 28, 2002 8:34 PM > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > > Subject: Re: [PHP] Htmlent

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Rasmus Lerdorf
> > Yeah, good catch on the addslash/magic_quote. > > > > Also, FYI: PHP will only allow you to do one query per mysql_query(). So > > you can't try to end a quote and then send another query. Don't know if > > this is the case for all database functions, or what... > > Does PHP this? Such behavio

RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes
> -Original Message- > From: Andre Dubuc [mailto:[EMAIL PROTECTED]] > Sent: Saturday, September 28, 2002 8:34 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] Htmlentities and Newlines? > > On Saturday 28 September 2002 07:55 pm, John W. Holm

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Sascha Cunz
> Yeah, good catch on the addslash/magic_quote. > > Also, FYI: PHP will only allow you to do one query per mysql_query(). So > you can't try to end a quote and then send another query. Don't know if > this is the case for all database functions, or what... Does PHP this? Such behaviour would be p

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
On Saturday 28 September 2002 08:19 pm, Sascha Cunz wrote: > > Hi John, > > > > Sorry about the ambiguity. What I'm trying to accomplish is close to what > > you describe. However, before anything goes into the db (ie html chars, > > bad commands, or anything from Mr.Hacker), I verify it. Someone

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Sascha Cunz
> /* db access using postgresql - each row is displayed */ > ... > {$myrow['request']} > ... > ?> > > Now unless I can do something like: > > 'nl2br({$myrow['request']}' Try something like echo ''.nl2br($myrow['request'].''; Regards Sascha -- PHP General Mailing List (http://www.php.net/)

RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes
ginal Message- > From: Sascha Cunz [mailto:[EMAIL PROTECTED]] > Sent: Saturday, September 28, 2002 8:19 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php- > [EMAIL PROTECTED] > Subject: Re: [PHP] Htmlentities and Newlines? > > > Hi John, > > > > Sorry about the

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
On Saturday 28 September 2002 07:55 pm, John W. Holmes wrote: > > Sorry about the ambiguity. What I'm trying to accomplish is close to > > what > > > you > > describe. However, before anything goes into the db (ie html chars, > > bad > > > commands, or anything from Mr.Hacker), I verify it. Someon

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Sascha Cunz
> Hi John, > > Sorry about the ambiguity. What I'm trying to accomplish is close to what > you describe. However, before anything goes into the db (ie html chars, bad > commands, or anything from Mr.Hacker), I verify it. Someone suggested, way > back when I first started with textarea, to use 'htm

RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes
> Sorry about the ambiguity. What I'm trying to accomplish is close to what > you > describe. However, before anything goes into the db (ie html chars, bad > commands, or anything from Mr.Hacker), I verify it. Someone suggested, way > back when I first started with textarea, to use 'htmlentities'

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
t; > -Original Message- > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, September 28, 2002 6:25 PM > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > > Subject: Re: [PHP] Htmlentities and Newlines? > > > > On Saturday 28 September 2002 03:30

RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes
:[EMAIL PROTECTED]] > Sent: Saturday, September 28, 2002 6:25 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] Htmlentities and Newlines? > > On Saturday 28 September 2002 03:30 pm, John W. Holmes wrote: > > > Perhaps I don't understand the use of 

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
On Saturday 28 September 2002 03:30 pm, John W. Holmes wrote: > > Perhaps I don't understand the use of 'htmlentities' too well, but I > > would > > > like newlines to be retained/inserted into a db, and then if > > displayed, to > > > produce a new line from a textarea. However, I want the possib

RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes
> Perhaps I don't understand the use of 'htmlentities' too well, but I would > like newlines to be retained/inserted into a db, and then if displayed, to > produce a new line from a textarea. However, I want the possibility of > dangerous html excluded (hence the use of 'htmlentities'). > > Is th

Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Chris Shiflett
nl2br() covertes newlines to tags (something a browser will render). Andre Dubuc wrote: >Perhaps I don't understand the use of 'htmlentities' too well, but I would >like newlines to be retained/inserted into a db, and then if displayed, to >produce a new line from a textarea. However, I want

[PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc
Perhaps I don't understand the use of 'htmlentities' too well, but I would like newlines to be retained/inserted into a db, and then if displayed, to produce a new line from a textarea. However, I want the possibility of dangerous html excluded (hence the use of 'htmlentities'). Is there some

Re: [PHP] htmlentities

2002-04-06 Thread Jason Wong
On Saturday 06 April 2002 18:34, Joerg Hanke [ML-php] wrote: > hi! > > i've got the following problem and hope one of you is able to help me > solving that: > > i've got a system in php that writes data (e.g. variable-name = $data) > to a mysql database. there are two more scripts: one for display

[PHP] htmlentities

2002-04-06 Thread Joerg Hanke [ML-php]
hi! i've got the following problem and hope one of you is able to help me solving that: i've got a system in php that writes data (e.g. variable-name = $data) to a mysql database. there are two more scripts: one for displaying the data and one for writing the data into a formular. the displaying