Specification of source charset encoding in MSVC++, like gcc “-finput-charset=CharSet”

For those who subscribe to the motto “better late than never”, Visual Studio 2015 (version 19 of the compiler) now supports this. The new /source-charset command line switch allows you to specify the character set encoding used to interpret source files. It takes a single parameter, which can be either the IANA or ISO character … Read more

PHP encoding with DOMDocument

Try: $string = file_get_contents(‘your-xml-file.xml’); $string = mb_convert_encoding($string, ‘utf-8’, mb_detect_encoding($string)); // if you have not escaped entities use $string = mb_convert_encoding($string, ‘html-entities’, ‘utf-8’); $doc = new DOMDocument(); $doc->loadXML($string);

Save Accents in MySQL Database

Personally I solved the same issue by adding after the MySQL connection code: mysql_set_charset(“utf8”); or for mysqli: mysqli_set_charset($conn, “utf8”); or the mysqli OOP equivalent: $conn->set_charset(“utf8”); And sometimes you’ll have to define the main php charset by adding this code: mb_internal_encoding(‘UTF-8’); On the client HTML side you have to add the following header data : <meta … Read more