Re: [PHP3] htmlentities and the like
| From: | Jonas Jochum | Date: | Fri, 12 Nov 1999 23:34:14 +0000 |
| Subject: | Re: [PHP3] htmlentities and the like | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6160@lists.php.net to get a copy of this message | ||
Hi!
Am 12.11.99, um 15:29 schrob jemand namens Richard Lynch etwa folgendes:
RL>I'm not sure you need to reverse it... It probably gets reversed by the
RL>browser...
RL>Or, if it's going to be displayed in a browser again, just leave it alone.
RL>But, if you need it:
RL>$text = str_replace('"', '"', $text);
Well, yeah, I already know that function. I would use it, if there weren't
so many things to convert.
I'll describe what I'm trying to do:
As I wrote in my previous mail, I programmed a script that opens a
template (html)-file. The umlaut, '<', '>','"' etc
characters are first
converted to " and the like. Then they are display in a textarea.
After that, the textarea-value (ie. the html-file) gets posted back to the
server. Then the server has to convert everything back to the normal
characters and write that stuff to a file.
I want to make that work easier. I don't like calling a function several
times, if it can be more easily done with one function. It also is pretty
ugly:
$string = str_replace('ä','ä',$string);
$string = str_replace('ö','ö',$string);
$string = str_replace('"','\"',$string); ...etc...for every
single
html entity.
You don't have to call str_replace() or ereg_replace() to convert " to
" or ä to ä but htmlentities(), so why should I need to call
these functions the other way around? I believe, there would also be a
little performance gain if it was done in C.
An idea: couldn't it be done using htmlentities? it would only need minor
changes - just pass a flag, like htmlentities($string,TO_ASCII) or
htmlentities($string,TO_HTML)
Would it be possible to do that?
Reg.,
Jonas Jochum
--
http://www.jonas-jochum.de | email@jonas-jochum.de
I'm signature virus '99. Copy me into your ~/.signature to help me spread.