UTF-8, PHP, Win7 - Is there a solution for saving UTF-8 files in Win 7 using php?

Update: just so that you don’t read everything: PHP starting with 7.1.0alpha2 supports UTF-8 file names on Windows. (Thanks Anatole Belsky!)

After some chain links in stackoverflow I found part of the answer:
qaru.site/questions/364295 / ... Umberto Salsi
(and on the same subject: qaru.site/questions/364295 / ... from Artefacto)
In short: "PHP associates [s] with the underlying file system as a "non-Unicode-capable program" ", and because of this, all the file names provided by PHP for Windows and vice versa are automatically translated / transcoded by Windows. This causes errors. And you, it seems, can not stop the automatic transcoding.
(And https://stackoverflow.com/a/167458/ ... from Artefacto:
PHP does not use wide WIN32 API calls , so you are limited to code. ")
And inhttps://bugs.php.net/bug.php?id=47096 there is an error report for PHP.

Although there, Nicholas suggests that the COM object can work!
$ fs = new COM ('Scripting.FileSystemObject', null, CP_UTF8);

Maybe I will try this sometimes. So, there is part of my questionnaire: is there PHP6, or was it withdrawn, or is there something new in PHP about this topic?

// complete question
Most of the questions on this topic are from 1 to 5 years. Can php now save the file using file_put_contents ($ dir. '/'. $ _POST ['fileName'], $ _POST ['content']);

when is $ _POST ['fileName'] encoded in UTF-8 encoding, for example, Crimea .xml? It is currently saved as DSn $ € Ñ <¼.xml

fileName, , UTF-8: echo mb_detect_encoding ($ _ POST ['fileName']);

:
1. file_put_contents ( UTF-16, UTF-16LE, ISO-8859-1 Windows-1252) Windows,
2. file_put_contents, Windows ( , , .) (, notepad ++ , .xml.)

, , , mb_convert_encoding ($ theFilename, 'Windows-1252', 'UTF-8')

"Warning: file_put_contents (dirToSaveIn/????. xml): : C:\aa xampp\htdocs\myinterface.lo\myinterface\phpWriteLocalSearchResponseXML.php 26" , " " .

+4
1

PHP, 7.1.0alpha2, UTF-8 Windows.

.

+2

Source: https://habr.com/ru/post/1546323/


All Articles