nlamirault / phpunit.el

Emacs mode to phpunit and test command line tool
GNU General Public License v2.0
34 stars 19 forks source link

Phpunit buffer displaying weird symbols #14

Open fxleblanc opened 8 years ago

fxleblanc commented 8 years ago

Example:

I                                                                   1 / 1 (100%)

Time: 406 ms, Memory: 20.00Mb

OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Incomplete: 1.
muddletoes commented 8 years ago

I'm seeing two sets of symbols that you shouldn't be seeing, here. The '�' symbol is a marker for an illegal (or at least undefined) unicode symbol, which suggests that the buffer is expected to contain UTF-8 encoded text, but is either receiving corrupted data or (8-bit or more) text in a different encoding. The "[30;43m" strings look awfully like ansi terminal colour codes.

This is probably a more general emacs problem related to display of colour codes, but I lack the experience to diagnose it definitively. You might try googling "emacs ansi colour display problems" to see if you can find relevant advice. Other that that, you should probably update your issue with your emacs version, OS, and language encoding.

fxleblanc commented 8 years ago

I found it! I simply need to call this snippet on the compilation buffer to display colors:

(defun display-ansi-colors ()
  (interactive)
  (let ((inhibit-read-only t))
    (ansi-color-apply-on-region (point-min) (point-max))))

Is there a hook in phpunit that I can leverage for this? Here's the link for the discussion: https://stackoverflow.com/questions/23378271/how-do-i-display-ansi-color-codes-in-emacs-for-any-mode

nlamirault commented 8 years ago

Do you have an opensource project with which I can reproduce this worries?

fxleblanc commented 8 years ago

@nlamirault sure, https://github.com/MaisonLogicielLibre/Website

gabrielelana commented 7 years ago

@nlamirault Since phpunit.el uses the standard *compilation* buffer, you can use the standard compilation-filter-hook, see this blog post