PHP FTP_GET - Can't handle special characters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
koolsamule
Forum Contributor
Posts: 130
Joined: Fri Sep 25, 2009 10:03 am

PHP FTP_GET - Can't handle special characters

Post by koolsamule »

Hi Chaps,

I have a PHP FTP app where users can up/download files.

Our company deals with foreign languages, so some of the files may have special characters, such as (German) umlauts. Uploading files with umlauts seems fine, but when I download a file, it goes from:
Häuse.pdf
to
Häuse.pdf
Is there any way to get round this, so it keeps the correct file name?

Cheers
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: PHP FTP_GET - Can't handle special characters

Post by tr0gd0rr »

Looks like the file path is stored in a charset that doesn't have the umlaut a. You should make your database field UTF-8.

Then, when you display or link to the URL, you need to use rawurlencode because the umlaut a and other characters must be encoded in the URL string.
Post Reply