phpunit.el icon indicating copy to clipboard operation
phpunit.el copied to clipboard

Phpunit buffer displaying weird symbols

Open fxleblanc opened this issue 9 years ago • 5 comments

Example:

[33;1mI[0m                                                                   1 / 1 (100%)

Time: 406 ms, Memory: 20.00Mb

[30;43mOK, but incomplete, skipped, or risky tests![0m
[30;43mTests: 1[0m[30;43m, Assertions: 0[0m[30;43m, Incomplete: 1[0m[30;43m.[0m

fxleblanc avatar Mar 14 '16 18:03 fxleblanc

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.

muddletoes avatar Mar 15 '16 05:03 muddletoes

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

fxleblanc avatar Mar 15 '16 14:03 fxleblanc

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

nlamirault avatar Mar 16 '16 11:03 nlamirault

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

fxleblanc avatar Mar 16 '16 12:03 fxleblanc

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

gabrielelana avatar Feb 27 '17 14:02 gabrielelana