When I'm trying to minify my HTML newsletter document, some newsletters doesn't convert normally to string, and this make a mistake when i trying to convert minify result to string by casting, the picture below show two documents after minifying the first is recognized as binary or non utf-8 character, and the second recognized as normal string. This has a relation to the characters used in this document and the special characters.

This problem makes a mistake when i am using the result of minifying in a library and this last try to convert the result to string to build a JSON object.

To solve this problem, I use mb_convert_encoding function of PHP to convert the result to utf-8 standard.
mb_convert_encoding( $string, "UTF-8");
When I'm trying to minify my HTML newsletter document, some newsletters doesn't convert normally to string, and this make a mistake when i trying to convert minify result to string by casting, the picture below show two documents after minifying the first is recognized as binary or non utf-8 character, and the second recognized as normal string. This has a relation to the characters used in this document and the special characters.

This problem makes a mistake when i am using the result of minifying in a library and this last try to convert the result to string to build a JSON object.

To solve this problem, I use mb_convert_encoding function of PHP to convert the result to utf-8 standard.