We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents fb19579 + 8bef16f commit fbab537Copy full SHA for fbab537
1 file changed
controller/main.php
@@ -311,7 +311,18 @@ private function display_pb()
311
312
if (!$file->error)
313
{
314
- $snippet_contents = utf8_normalize_nfc(utf8_convert_message(@file_get_contents($file->get('filename'))));
+ // Well, ugly solutions work, too
315
+ $snippet_contents = @file_get_contents($file->get('filename'));
316
+ // Check for UTF-8 encoding; because utf8_convert_message() will destroy utf8-characters in UTF-8 documents
317
+ if (mb_detect_encoding($snippet_contents, 'UTF-8', true))
318
+ {
319
+ $snippet_contents = utf8_normalize_nfc($snippet_contents);
320
+ }
321
+ // e.g. ISO 8859-1 encoded files need the utf8_convert_message()
322
+ else
323
324
+ $snippet_contents = utf8_normalize_nfc(utf8_convert_message($snippet_contents));
325
326
}
327
328
$file->remove();
0 commit comments