FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » reading files with accents in the filename from PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: reading files with accents in the filename from PHP [message #183107 is a reply to message #183106] Wed, 09 October 2013 10:58 Go to previous messageGo to previous message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma:
Senior Member
Erwin Moller schrieb:

> How can PHP open files on the local filesystem that contain certain
> characters, like umlauts, accents, etc?

$path = __DIR__ . '\Eugène.txt';
var_dump( PHP_VERSION, file_exists( $path ) );

Works on my Windows XP, PHP 5.4.8, *if* the PHP file is stored in ANSI
(="Windows") encoding. Doesn't work if stored in UTF8. So I suspect it's
an encoding issue: the accented character "è" is stored as \xE8 in the
file system, but if your script is UTF8, then your $path will contain
\xC3\xA8 instead. With an "explicit" $path = __DIR__ . "\Eug\xE8ne.txt"
it works when the script is UTF8.

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PDO - Cannot retrieve warnings with emulated prepares disabled
Next Topic: Secure website
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 20:51:02 GMT 2024

Total time taken to generate the page: 0.04762 seconds