www.webdeveloper.com
Results 1 to 4 of 4

Thread: file_get_contents("משלי.xml")

  1. #1
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887

    file_get_contents("משלי.xml")

    file_get_contents doesn't seem to allow me to open any file with unicode characters within its file name.

    Source of storeUnicodeCharsSafely.txt set to utf-8:
    Code:
    משלי.xml
    PHP Code:
    <?php
    $XMLFileName
    =file_get_contents("storeUnicodeCharsSafely.txt");
    echo 
    file_get_contents($XMLFileName);//file does not exist
    ?>
    Just because the file name contains unicode characters, does the file become TOTALLY unaccessible to PHP? Surely there is some kind of input string I can feed it that would represent the file. Can mb_convert_encoding help?
    Last edited by Ultimater; 02-06-2007 at 11:05 PM.

  2. #2
    Join Date
    Dec 2006
    Location
    Escaz˙ (Costa Rica) and Mallorca (Spain)
    Posts
    3,234
    I had a similar problem trying to read German files. I just used utf8_decode($file_name) and it solved it for me...

  3. #3
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    I saved my PHP page under the utf-8 encoding and ran:
    Code:
    <?php
    echo file_get_contents(utf8_decode("משלי.xml"));
    ?>
    and it fails to open the file. Guess Hebrew characters are different...

  4. #4
    Join Date
    Jan 2005
    Location
    Los Angeles, CA
    Posts
    4,887
    Maybe I could use Perl here to escape the Hebrew characters first then pass the encoded string to PHP. Hmm...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles