473,809 Members | 2,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

quotes in file names

Hi to all,

I am developing a php web browser application.

But i have a problem.

I am listing with opendir but there are a lot of files with
quotes in their names.

example: News Letter for "ebal" today.html
(yes the above is only one file !!!)

When i browsing the files the listing doesn't show me the full name of
my files, because of the quotes in the filename.

Any ideas?

php 4.4.4

best regards,
-ebal
Sep 7 '06 #1
3 1974
You could use the htmlspecialchar s function to convert the quotes to
" for browser display.

http://au.php.net/manual/en/function...ecialchars.php

Balaskas Evaggelos wrote:
Hi to all,

I am developing a php web browser application.

But i have a problem.

I am listing with opendir but there are a lot of files with
quotes in their names.

example: News Letter for "ebal" today.html
(yes the above is only one file !!!)

When i browsing the files the listing doesn't show me the full name of
my files, because of the quotes in the filename.

Any ideas?

php 4.4.4

best regards,
-ebal
Sep 7 '06 #2
Noodle wrote:
You could use the htmlspecialchar s function to convert the quotes to
" for browser display.

http://au.php.net/manual/en/function...ecialchars.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.
Sep 7 '06 #3

Balaskas Evaggelos wrote:
Noodle wrote:
You could use the htmlspecialchar s function to convert the quotes to
" for browser display.

http://au.php.net/manual/en/function...ecialchars.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>' . htmlspecialchar s($file) . '</li>';
}
echo '</ul>';
closedir($handl e);
}
?>

Sep 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4285
by: Google Mike | last post by:
I'm discovering that my pg_query isn't working because PostgreSQL is wanting double quotes around my column names and table names. Is there a way to turn quoted identifiers off?
0
1567
by: Jim Hatfield | last post by:
Yet another file upload post! I've read the annotated manual and googled, but haven't seen this one. Uploading using the code given in the manual, if I upload a file called tha"ng
4
4422
by: Dave Moore | last post by:
Hi All, Can anybody point me to a FAQ or similar that describes what all this stuff is about please?. I'm interfacing with a MySQL database if that's relavent. I've read a couple of books which refer to stripslahes and 'escaping' but nothing really explains what these terms are and why these are used. Why is 'escaping' (whatever that is) used?. What the hell is a magic quote?. How is it different from a non-magic one?. Regards, Dave
4
3321
by: | last post by:
Hi I have an asp page.I have all the form tags, javascripts etc in that. For e.g In my asp page I have mentioned my form tag as <form name=frmupdateskill method=post> and javascript as <script language=javascript> some code... </script>
3
429
by: Danny | last post by:
Here is the sql statement. Set rs2 = db.OpenRecordset("select * from Names where InStr(descriptions" + "+" + """" + "|" + """" + "," + """" + asearchkey + """" + ") > 0") this searches a recorset and returns all the names that have asearchkey somewhere in their description so if "hello" is in "this is a hello test" will be returned
1
6329
by: Zlatko Matić | last post by:
I have a problem when working with PostrgeSQL as back-end. Namely, PostgreSQL syntax uses doble quotes for table names and field names. For example: select = from public."Customers" Therefore, when I write it as a string of a pass-through query or Command Text of ADO Command object it looks like: "select * from public."Customers"" anbd VBA thinks that the first quote after public. is the end of statement. How to solve it ?
24
22667
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double quotes? Do I need to use code to scrub each string and remove or escape the double quotes before using it in a query? The error I get is this: Error Number 3075: Syntax error (missing operator) in query expression '"credit card billed by...
0
80739
NeoPa
by: NeoPa | last post by:
Background Whenever code is used there must be a way to differentiate the actual code (which should be interpreted directly) with literal strings which should be interpreted as data. Numbers don't usually have this problem but Dates can too. Debug.Print Me.ControlName refers to a control on a form. Whereas, Debug.Print "Me.ControlName" simply prints the literal text Me.ControlName Where to Use Each Quote Type (' or ") In some places...
4
12784
by: Michael Yanowitz | last post by:
Hello: If I have a long string (such as a Python file). I search for a sub-string in that string and find it. Is there a way to determine if that found sub-string is inside single-quotes or double-quotes or not inside any quotes? If so how? Thanks in advance: Michael Yanowitz
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.