gitter icon indicating copy to clipboard operation
gitter copied to clipboard

PrettyFormat trips on invalid UTF-8 sequences

Open lionello opened this issue 11 years ago • 1 comments

The guichan repo (https://code.google.com/p/guichan/) has some log entries which are utf-8 encoded, some which are not. All of these get appended together and the XML encoder has not way to parse the string.

Fixed by adding a single line to getPrettyFormat in Repository.php:

     public function getPrettyFormat($command)
     {
         $output = $this->getClient()->run($this, $command);
         $format = new PrettyFormat;

+        // Remove invalid UTF-8 sequences (which would trip the XML parser)
+        $output = mb_convert_encoding($output, 'UTF-8', 'UTF-8');
         return $format->parse($output);
     }

lionello avatar Jul 22 '13 03:07 lionello

please work here: https://github.com/patrikx3/gitter

p3x-robot avatar May 16 '17 20:05 p3x-robot