dongmu5246 2014-04-10 05:52
浏览 87
已采纳

php中的scandir与特殊(匈牙利)字符

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!

  • 写回答

2条回答 默认 最新

  • douyi2107 2015-06-29 20:03
    关注
    iconv("windows-1254", 'UTF-8', $foldername)
    

    Same problem same language, I assume this should work for you too

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部