![]() In PHP, you can achieve such thing using the iconv function, trying to detect the encoding of your data (usually UTF-8) and convert it into the new format namely Windows-1252 (CP1252): "encoded_output_file.txt" Unicode also has control characters in that range. Windows-1252 (the code page most commonly referred to as "ANSI") is similar to ISO 8859-1 (Latin-1), except that Windows-1252 has printable characters in the range 0x80.0x9F, where ISO 8859-1 has control characters in that range. They were based on drafts submitted for ANSI standardization, but ANSI itself never standardized them. ![]() In some enterprises, this process is necessary as the software of other big companies is out of date and doesn't operate well with the UTF-8 default encoding, so you will need to change obligatorily the encoding of your generated files to the named "ANSI" codification. The term "ANSI" when applied to Microsoft's 8-bit code pages is a misnomer. This leads to a simply conjecture, the charset of the text file is defined by its data, so you need to convert the data that you will write into the file to a specific format. The fwrite function of PHP or file_put_content doesn't care about metadata of the file, it just writes the given data to the storage and that's it.
0 Comments
Leave a Reply. |