Add BOM: UTF-8
file_put_contents($myFile, "\xEF\xBB\xBF". $content);
More Related Contents:
- How can I detect a malformed UTF-8 string in PHP?
- Detect encoding and make everything UTF-8
- Convert utf8-characters to iso-88591 and back in PHP
- PHP json encode – Malformed UTF-8 characters, possibly incorrectly encoded [duplicate]
- How to handle user input of invalid UTF-8 characters
- json_encode() non utf-8 strings?
- PHP messing with HTML Charset Encoding
- utf8_(en|de)code removed from php7?
- utf-8 special characters not displaying [duplicate]
- Replacing invalid UTF-8 characters by question marks, mbstring.substitute_character seems ignored
- Ensuring valid UTF-8 in PHP
- UTF8 Filenames in PHP and Different Unicode Encodings
- How do I detect if have to apply UTF-8 decode or encode on a string?
- How to decode Unicode escape sequences like “\u00ed” to proper UTF-8 encoded characters?
- How to remove multiple UTF-8 BOM sequences
- PHP: Convert any string to UTF-8 without knowing the original character set, or at least try
- MySQL and PHP: UTF-8 with Cyrillic characters [duplicate]
- Fixing broken UTF-8 encoding
- Email from PHP has broken Subject header encoding
- Multibyte trim in PHP?
- can I get the unicode value of a character or vise versa with php?
- Getting data with UTF-8 charset from MSSQL server using PHP FreeTDS extension
- is PHP str_word_count() multibyte safe?
- decode a quoted printable message in php
- ‘Malformed UTF-8 characters, possibly incorrectly encoded’ in Laravel
- strlen() and UTF-8 encoding
- How to skip invalid characters in XML file using PHP
- How can I sort an array of UTF-8 strings in PHP?
- CURL import character encoding problem
- How to keep json_encode() from dropping strings with invalid characters