• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Solved [SOLVED]Handling a UTF-8 file via Apache for download - how?

rekabis

Member


Messages: 32

#1
I have myself a bit of a puzzle.

I have a résumé, and I would like to keep it named résumé.pdf so that when it is downloaded by someone from my web site it actually shows up as résumé.pdf (as in, “we looked at his Résumé”) and not something called resume.pdf (as in “let’s resume this task”). However, when I upload the file via FTP, it cannot be accessed by either its UTF-8 file name or its URL-encoded file name (r%C3%A9sum%C3%A9.pdf).

The most important thing for me is the downloading of the file as a UTF-8 file name with e-accent-agu in the name itself. As long as I can get the link to the file to work correctly, I can also make .htaccess redirects (redirecting resume.pdf to résumé.pdf) to work as well.

Right now when I look at the file on the file system in Terminal, I see the file as being r?sum?.pdf. The only way to access it is to re-name it as resume.pdf.
 

worldi

Active Member

Thanks: 21
Messages: 189

#2
Re: Handling a UTF-8 file via Apache for download - how?

What happens if you copy the file to résumé.pdf? (I feel dirty now)

That's the ISO8859-1 representation of the UTF-8 encoded version. This might work as a quick fix.

The problem seems to be that the browser requests are encoded in UTF-8 but the filename is encoded in ISO8859. There is converters/convmv to change the encoding of filenames. However, the real solution is to change the FTP user's default encoding (via login.conf()) so the filenames are encoded correctly in the first place.
 

rekabis

Member


Messages: 32

#3
Re: Handling a UTF-8 file via Apache for download - how?

worldi said:
What happens if you copy the file to résumé.pdf? (I feel dirty now)
Holy Mary, mother of god. That worked. Don’t feel dirty -- even editing login.conf to include
Code:
:charset=UTF-8:\
:lang=en-CA.UTF-8:
in the default:\ section did not help, even after a restart of the FTP server and a re-connection. This is what I tried between my post and your answer.

Thankfully, this should be only one of a very few select files with UTF-8 characters.
 

xtaz

Well-Known Member

Thanks: 64
Messages: 310

#4
Re: [SOLVED]Handling a UTF-8 file via Apache for download -

Did you run cap_mkdb /etc/login.conf after you edited the file?
 

rekabis

Member


Messages: 32

#5
Re: [SOLVED]Handling a UTF-8 file via Apache for download -

xtaz said:
Did you run cap_mkdb /etc/login.conf after you edited the file?
Yes I did. I even logged out and logged back in; no change in how the file was being displayed in Terminal.

Also, additional problem here. I have detailed my problem under ServerFault, but essentially I cannot get a URL with resume.pdf to redirect to résumé.pdf; at least in a way that would allow the file to be accessed in the same way as if the file name was manually entered.