2

I wrote a c++ program and when I compiled it using g++ in ansi-term, I got some strange characters displayed:

enter image description here

If required, the error was that i hadn't declared the variable n. How can I correct this?

sudeepdino008
  • 3,194
  • 5
  • 39
  • 73
  • Looks like you're using `gccfilter` or something similar to color your output. Those are terminal escape sequences. – Sean Bright Jan 16 '13 at 17:51

3 Answers3

5

Ah! Tested this...

 (setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

and problem solved!!!

sudeepdino008
  • 3,194
  • 5
  • 39
  • 73
3

Looks like the gcc output contains UTF-8 "smart quotes" and your terminal is not set up to display UTF-8. The simple workaround is to use a locale which does not support smart quotes inside Emacs, which should force gcc to fall back to plain-jane ASCII quotes; a more sophisticated fix would be to fix the terminal mode in the Ansi-Term buffer to display these correctly.

tripleee
  • 175,061
  • 34
  • 275
  • 318
1

Those are most likely color escape sequences. emacs has a mode for that which you can enable with the ansi-color-for-comint-mode-on function.

jtahlborn
  • 52,909
  • 5
  • 76
  • 118