I'm having a problem displaying images with greek filenames (eg 'φωτογραφία.jpg') in a browser. Using this script I found out which 2 encodings I need to use with iconv() so I can get the filename to display correctly in a browser. The image itself though fails to render.
<?
$file = 'φωτογραφία.jpg';
$encodings = array("UTF-8", "ASCII", "Windows-1253", "ISO-8859-1", "UTF-16");
$iconv = "";
foreach ($encodings as $i) {
foreach ($encodings as $j) {
if($j!==$i) $iconv .= "<br /> $i -> $j: ".iconv($i, $j, $file);
}
}
echo $iconv;
?>
Working link here, which retuns the correct filename when converting from UTF-8 -> Windows-1253.
The environment is PHP 5.2.17 on Apache/2.2.22 (Unix) and the files have been uploaded from a Windows machine. Currently, I've only tested 2-3 images by hardcoding them into a test PHP file. Do you think it would be different if the filenames were pulled from a database query?