Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use files with special characters? 2

Status
Not open for further replies.

Sleidia

Technical User
May 4, 2001
1,284
FR
Hi :)

I have folders filled with PDF files with filenames containing special characters (ie: Bébés & Enfants.pdf).

I usually rename files so that they don't contain special characters, but this time, I need to keep the filenames unchanged because they are displayed as a list of categories that must be human readable.

The problem is that the server can't find some of them when they are called via a simple href link.

I've tried to rename the files with rawurlencode() and then display the filenames with rawurldecode(), but still, the server can't find the files.

How am I supposed to handle that matter?

Thanks for the help! :)

 
The file names should not be an issue.

As an example I created a dummy file
and named it: Bébés & Enfants.pdf

PHP's file() function had no problem opening the file and displaying its contents.

How are you trying to open the files, perhaps you have a permissions or path issue with them.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Hi Sleidia,

long time no hear!

i think the issue may be that the file system uses the extended ascii character set whereas you may be delivering content using another charset. in this way an é may look like an é but, in fact, could be being interpreted as something completely different by the receiving apache server.

so my thoughts are:

1. synchronise your charsets all over the place; or
2. store mappings between files and filenames in a database and serve the files using a php document server rather than direct links?

personally, i prefer the second option as it gives you, as the programmer, more control.
 
Hi guys, yeah it was quite a long time not being here ;)

Actually, I got rid of the issue by using a different method.

Thanks again for the help ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top