php file name problems

Atari talk, or the life and the universe and things. Just keep it clean!
Post Reply
User avatar
exxos
Site Admin
Posts: 2230
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

php file name problems

Post by exxos » Tue May 01, 2018 5:07 pm

Thought I would throw this one out there is my brain has gone to sleep..

Basically I'm reading filenames from my database, but some filenames look like this with special characters.
1.JPG
1.JPG (2.06 KiB) Viewed 124 times


When I output them as image filenames in my HTML page appears like this..
2.jpg
2.jpg (4.42 KiB) Viewed 124 times

So obviously the filenames do not match and the image does not get displayed.. Obviously these filenames should not be like this in the first place.. But how can I get PHP to output the actual correct file name?

Currently as it stands, special character files appear as missing images, even though they are actually there..
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

tuxie
Posts: 68
Joined: Thu Aug 24, 2017 11:51 am

Re: php file name problems

Post by tuxie » Tue May 01, 2018 6:15 pm

Hi,

you have to use UTF8 in HTML and also in PHP code and Mysql aswell, check the syntax to change the coding...

User avatar
exxos
Site Admin
Posts: 2230
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: php file name problems

Post by exxos » Tue May 01, 2018 8:14 pm

I figured it out I think, had to use utf8_encode to get the file name to show correctly on the webpage.. This then matches the name in the database.. But it still did not match the actual file name on the server.. I think the problem is the files were originally stored on the Windows-based server, and some of the characters got messed up when I copied it over to my limits based server.. So I just renamed the file on the server to match the one in the database.. And now it works..
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

Post Reply