You are here: Re: quotes in file names « PHP Programming Language « IT news, forums, messages
Re: quotes in file names

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);
}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация