Bug #77711 [Asn->Wfx]: CURLFile unable to handle UNICODE filenames

From: Date: Wed, 13 Mar 2019 09:27:07 +0000
Subject: Bug #77711 [Asn->Wfx]: CURLFile unable to handle UNICODE filenames
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219940@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77711&edit=1 ID: 77711 Updated by: kalle@php.net Reported by: anrdaemon at freemail dot ru Summary: CURLFile unable to handle UNICODE filenames -Status: Assigned +Status: Wont fix Type: Bug Package: cURL related Operating System: Windows PHP Version: 7.3.3 -Assigned To: ab +Assigned To: Block user comment: N Private report: N New Comment: Thanks a lot Anatol for your detailed description, I personally like option 3 (which is similar to parts of libgd), but this is now all in cURL's hands and I don't think we should engineer a fix that could be potentially incompatible, but instead hope it can and will be fixed in cURL. @anrdaemon If you report it upstream to cURL, then please link to this ticket. I will mark it as a "Won't Fix". Thank you! Previous Comments: ------------------------------------------------------------------------ [2019-03-12 20:46:06] anrdaemon at freemail dot ru Understood, thanks for looking into the issue. I'll bring it up with cURL, if you don't mind. ------------------------------------------------------------------------ [2019-03-12 11:04:17] ab@php.net It functionality in the description has been never present in PHP in the claimed form. libcurl still uses ANSI APIs which causes reports like https://github.com/curl/curl/issues/345. A solution needs to be done on the side cURL to - always handle filenames as UTF-8, use Unicode APIs internally and do conversion, or - export additional APIs based on wide chars, or - export handlers for I/O operations, that can be overridden The first option could be the easiest, but it would be a huge BC breach. The second option might be more compatible, but it might lead to duplicating a lot of APIs. The third option would regard to fopen, stat and several other I/O APIs involving filenames. Then any consuming library could make this part of cURL compatible to its needs. Perhaps that would be the cleanest way. cURL could be also compiled with UNICODE, but i'm not sure it would really work. Fe see places like this https://github.com/curl/curl/blob/f762fec323f36fd7da7ad6eddfbbae940ec3229e/src/tool_filetime.c#L40 where ANSI function is used directly so would stay same even with UNICODE. And in any case PHP can't be compiled with UNICODE, so that's not an option. @anrdaemon what merely has changed is, that you don't pass the filename in the ANSI codepage anymore, so the commented out iconv fix brings it to the correct state. Thanks. ------------------------------------------------------------------------ [2019-03-12 00:21:33] anrdaemon at freemail dot ru If you ask me, since PHP does filenames' charset conversion by itself (Win32 API does not support UTF-8 to the best of my knowledge), the solution should likely fall to cURL ext. ------------------------------------------------------------------------ [2019-03-11 23:06:20] kalle@php.net @Anatol, can you confirm my theory? Daniel said on Twitter that he did not have the time to look into this issue, but told us to report it upstream if its an actual cURL issue ------------------------------------------------------------------------ [2019-03-11 22:55:29] kalle@php.net From a quick read, it seems like the issue is caused in cURL itself, as internally we pass the filename supplied directly to curl_formadd(). I see two ways we can fix this: 1) Upstream fix from cURL 2) Implement a file name normalization fix for Windows, however I do not know how this will affect cURL Assigning this to Daniel, perhaps he can share some insights on this. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=77711 -- Edit this bug report at https://bugs.php.net/bug.php?id=77711&edit=1

« previous php.bugs (#219940) next »