Posted by Noodle on 09/08/06 08:01
Balaskas Evaggelos wrote:
> Noodle wrote:
> > You could use the htmlspecialchars function to convert the quotes to
> > " for browser display.
> >
> > http://au.php.net/manual/en/function.htmlspecialchars.php
> >
>
> doesn't work,
>
> because my special char is double quote "
> and not 2 quotes ('') as opedir gives me.
>
> ---
>
> The problem is in opendir function.
> The opendir function read the filename with double quotes.
> Do you thing this is a bug?
>
> I changed the php.ini config about quotes but still the opendir
> convert the double quotes in two quotes.
You may not be using the function correctly. From the manual...
'"' (double quote) becomes '"' when ENT_NOQUOTES is not set ... If
ENT_QUOTES is set, both single and double quotes are translated and if
ENT_NOQUOTES is set neither single nor double quotes are translated.
The following code works for me:
<?php
if ($handle = opendir('.')) {
echo '<ul>';
while (false !== ($file = readdir($handle))) {
echo '<li>' . htmlspecialchars($file) . '</li>';
}
echo '</ul>';
closedir($handle);
}
?>
[Back to original message]
|