Shooting Stars
Shooting Stars

Reputation: 835

Reading images with special characters in Apache web server

When I try to GET images that have special characters like ấ in the filename, I can't read the files on the frontend. It will always throw a 404 error when navigating to the url as well.

My server os is CentOS, and my site is running on Apache with Nodejs. I was wondering if I have to somehow change the file encoding in order to read images with special characters. All normal images work fine, it just seems to not recognize the images with special characters at all.

There are a lot of files, which makes renaming them all not an option for me unfortunately. If anyone knows what I have to do to get the files to the correct encoding, please let me know.

Update: I've discovered a way to find the files, but I dont understand the encoding pattern. For example a file known as kt-giấy-2.jpg can be viewed directly using kt-gia%CC%82%CC%81y-2.jpg, does anyone know what kind of encoding this is? It doesnt line up with URI encoders.

Upvotes: 0

Views: 229

Answers (1)

Shooting Stars
Shooting Stars

Reputation: 835

For anyone that has this issue. My issue was that I transferred the files from Mac Osx to Centos directly through a zip file through Cpanel. The files are fine, but you need to use convmv to change the files. The files were readable, but they werent in the exact encoding.

Mac OSX encodes in NFC, every other os encodes in NFD

use this command in the directory of the files you want to encode differently.

convmv -r -f utf8 -t utf8 --nfc --notest .

Upvotes: 1

Related Questions