Re: php can't resolve 8.3 paths to unicode filenames, is that expected ?
| From: | Anatol Belski | Date: | Tue, 30 Jul 2013 16:32:42 +0000 |
| Subject: | Re: php can't resolve 8.3 paths to unicode filenames, is that expected ? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-31077@lists.php.net to get a copy of this message | ||
On Tue, July 30, 2013 00:25, R. S. wrote:
> The thing is these paths do not have any non ascii chars in them. Old 16b
> win311 apps are perfectly fine with such files, they just can't correctly
> show their name nor create a fresh file with non ascii name. And such
> behavior I was expecting from php.
>
>
> <?
> $FS = new \COM('Scripting.FileSystemObject', null, CP_UTF8);
> $FS->CreateTextFile("c:\\Ελλάδα.txt");
> $ShortPath = $FS->GetFile("c:\\Ελλάδα.txt")->ShortPath;
> echo $ShortPath; file_get_contents($ShortPath); ?>
>
>
> error:
> Warning: file_get_contents(C:\BFEE~1.TXT): failed to open stream: Invalid
> argument in C:\test.php on line 12
>
> I think somewhere down the rabbit hole the function tries to recreate
> original path and then gets confused.
>
> Is there any way around it ? Like creating a handle from a COM object, or
> a separate protocol like in file_get_contents("php://stdin"), or whatever
> to pass it to the fopen() so php won't see the offending name ?
>
This is a known issue with 8 bit filenames, please read here
https://bugs.php.net/bug.php?id=64699 . If you
work with COM, why don't
you use it to get the file contents?
Regards
Anatol