Re: php can't resolve 8.3 paths to unicode filenames, is that expected ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Pierre,

Thursday, August 8, 2013, 7:07:04 AM, you wrote:

> PHP does nothing with the paths a script passes to the IO function.
> The only operation being done is to resolve relative paths and the
> likes but that will only prepend the given path with the current
> directory and remove ../.. part of the given paths.

I know that. FreePascal must be doing the same.
But in much older FP it works, in php don't.

> The path is then given as is to the underlying OS file functions,
> which work only with ANSI or the current system charset (CP-*). PHP
> works perfectly fine with short path, even the ones with ~ in them.

No, php doens't work with short paths that are leading
to unicode long versions though these short paths do
not have any unicode chars in them. And that is the puzzle.

I think php filesystem functions try to do a little more than
they can handle with short paths.

> The problem I can see here (but can't confirm as I do not have your
> original source code to verify) is that the encoding seems to be UTF-8
> and that won't work per se.

The code is provided in this thread and in my (dismissed)
bug report.

    <?
    $FS = new \COM('Scripting.FileSystemObject', null, CP_UTF8);
    $FS->CreateTextFile("c:\\Ελλάδα.txt");
    $ShortPath = $FS->GetFile("c:\\Ελλάδα.txt")->ShortPath;
    echo $ShortPath;
    $handle = fopen($ShortPath, 'w');
    ?>

Here the file is created trough COM as it is stated in source code.
The com object isn't having any problem with translation from utf
to encoding used with windows file systems.

> Also UTF-8 (or the likes) paths for IO operation has nothing to very
> little to do with Unicode support as described or tried in the never
> released PHP 6. It is "only" about using another set of the Windows
> file APIs, in very short, about using the <funcname>W ones instead of
> the <funcname>A (which are aliases to <funcname> when UNICODE define
> is not set).

So this should be trivial to change in php's source code.



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux