I've been trying to read (image) files a folder in my website. But, there's a problem! There are some special hungarian character (like: á,í,ú,ű,ó,é, etc...) in the name of the folder which I want to read. I've been trying many mode, but it doens't work. My php code:
<?php
$images = scandir("images/2005/avatás/");
foreach($images as $file) {
print($file);
}
?>
I've been trying to fix the problem, with mb_convert_encoding(), urlencode(), urldecode() functions, but these couldn't help me.
Have you got any idea?
Thanks!
iconv("windows-1254", 'UTF-8', $foldername)
Same problem same language, I assume this should work for you too
You could try using iconv()
<?php
$folder = iconv("windows-1251", "UTF-8", "images/2005/avatás/");
$images = scandir($folder);
foreach($images as $file) {
print($file);
}