הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   PHP | עבודה עם קבצים בעברית (https://hosts.co.il/forums/showthread.php?t=97047)

kfir-d 02-05-12 11:21

PHP | עבודה עם קבצים בעברית
 
היי,
בניתי איזה סקריפט קטן שמציג קבצים (תמונות) אשר ממוקמות בתוך תיקיה הבעיה עם תיקיות בעברית הוא פשוט לא מתייחס,
אם התיקיה באנגלית זה עובד מעולה
זה הקוד

PHP קוד:

<?php 
$get
="gallery_files";
$f=$_GET['f'];
$f iconv"iso-8859-8""utf-8"$f);
$ftpurl="../../'.$get.'";
$handle opendir('../../'.$get.'/'.$f.''); 
while (
false !== ($file readdir($handle))) { 
$file iconv"iso-8859-8""utf-8"$file);

    if (
$file != "." && $file != ".." && $file != "name.txt") {

$porm=end(explode("."$file));

switch (
$porm){

    case 
jpg:
echo
"הצגת תמונה";
        break;
default:
echo
"";
}
    } 
}
closedir($handle);
?>


Programnnd 02-05-12 11:52

אולי תנסה קידוד windows-1255

kfir-d 02-05-12 14:46

ניסיתי כבר לא עובד

DoLet 02-05-12 16:05

אני לא בטוח אבל תנסה אולי Hex code...

kfir-d 02-05-12 16:28

ציטוט:

נכתב במקור על ידי DoLet (פרסם 843200)
אני לא בטוח אבל תנסה אולי Hex code...

לא מכיר אני אשמח להסבר

Daniel 02-05-12 22:21

PHP קוד:

<?php
$get
="gallery_files";
$f=$_GET['f'];
$f_converted iconv"iso-8859-8""utf-8"$f);
var_dump($f);
echo 
"Directory:\n";
print_r(scandir('../../'.$get.'/'));
echo 
"Normal:\n";
print_r(scandir('../../'.$get.'/'.$f.''));
echo 
"Converted:\n";
print_r(scandir('../../'.$get.'/'.$f_converted.''));
?>

תסתכל ותראה אם התוצאות מתאימות למה שאתה מצפה לקבל - ואם עדיין לא מצליח אתה מוזמן לפרסם את הפלט.

kfir-d 03-05-12 08:50

קוד:

string(12) "ניסיון" Directory: Array ( [0] => . [1] => .. [2] => 123456 [3] => bitl [4] => test [5] => ������ [6] => ���� ) Normal:
Warning: scandir(../../gallery_files/ניסיון) [function.scandir]: failed to open dir: No such file or directory in /home/mobi/domains/domain.com/public_html/models/gallery/index.php on line 52

Warning: scandir() [function.scandir]: (errno 2): No such file or directory in /home/mobi/domains/domain.com/public_html/models/gallery/index.php on line 52
Converted: Array ( [0] => . [1] => .. [2] => 123456 [3] => bitl [4] => test [5] => ������ [6] => ���� )


Daniel 03-05-12 09:53

באיזה קידוד שמור הקובץ עם הקוד עצמו? יכול להיות שהוא לא UTF-8?

kfir-d 03-05-12 11:17

UTF-8 בדוק

DoLet 03-05-12 15:11

������ זה בעיקר בעיות קידוד,
תנסה לתת הרשאה של 777 לתיקיה שאתה סורק.

תנסה לעשות עם HEX CODE כמו שאמרתי לך:
http://www.swingnote.com/tools/texttohex.php

תשתמש ב- Hex Encoded for URL.


כל הזמנים הם GMT +2. הזמן כעת הוא 07:21.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ