Page 1 of 1

Error downloading a file with accents. :s

Posted: Wed Jun 13, 2007 11:19 am
by Mirux
Check this: http://www.codersphp.com/mirux/DHH/inde ... =ebiblicos

Try to download "Sin Autor - No es fácil" or any file that has áéíóúñ in author's name or title's name. And you'll get that error.

This is the part of the code:

Code: Select all

echo "<a class='ico' href='./files/".$msg->author. " - ". $msg->title. ".doc"."'><center><img src='./images/doc.gif'></center></a>";
Any idea how to solve this? I am avoiding to rename the files to someone like 01.doc, etc.. Because I need them with its right name.

By the way, special characters I solved them with htmlentities();

Posted: Wed Jun 13, 2007 11:24 am
by superdezign
You'll have to remove the special characters from the filenames, or url-encode the links to them.

Posted: Wed Jun 13, 2007 12:19 pm
by Mirux
How is that url enconding thingy? I've tryed that before but it doesn't seem to work.

Where should I add it?

Posted: Wed Jun 13, 2007 12:25 pm
by John Cartwright
Pass your filenames through urlencode()

Posted: Wed Jun 13, 2007 4:59 pm
by Mirux
Well, actually I fixed it with a simple header.

I inserted this line:

Code: Select all

header("Content-Type: text/html;charset=ISO-8859-1");
Maybe it is not a proper way to fix this but it works. I don't see any other good solution.

If anyone knows a better one, let me know.

Thanks guys for the support.