0
I have a problem that so far I could not solve. When I use the function copy()
php, the file that is copied from one place to another causes files that have accentuation to be uncharacterized as to its name.
I’m using IIS 10 in Windows 10 and PHP 5.3.9.
copy(string $source , string $dest);
I already printed the $dest
and the names come out correctly, but when the function is executed I will check in the destination folder the file is with its name all mischaracterized according to name below an XML file that the correct name would be Padrão José e Porâ.xml
(I am using these accents for testing purposes.)
Padrão_josé_e_porâ.xml
(Wrong file name)
I know the function copy()
has a third parameter for stream_context_create()
however I could not find examples of using this parameter to be used locally.
The mistake happens after the function is executed, that is, the file that is copied from one place to another is accentuated, the reason I do not know because I pass the correct name in the variable $dest
.
I’ve also added header('Content-Type: text/html; charset=utf-8');
in the PHP file.
Any opinion?
Thank you.
Hello @Acco this answer suggested by you does not match the problem I have, I’m having trouble with the php copy() function as commented in the text I write and not only in encoding itself. The error is being generated after the function is executed!
– Renan Santos
In fact the problem has great chance to be the same (not in relation to the encoding of the output, but in relation to improper conversion). What you need is to locate in the code which of the subsystems is doing the improper conversion. If you can put the snippets of code that manipulate and capture the file name, we can analyze it better. Remember that every publication, even closed, is subject to revision (and even reopening if in fact it is a different problem). But for this, if [Edit] and put the relevant code, it is easier to help (either by reopening, or by guiding how to apply the solution).
– Bacco
For greater chance of solution, it would be good for all the snippets handling $source and $dest. The idea here is to get the problem solved, however. We just need more material to analyze.
– Bacco