2

I have this character appearing in places in some files I have: Â (if you can't see it or it looks like a question mark it's the Acirc character (capital A with a circumflex over it))

I simply want to grep replace this char with a space, however when I do this:

grep --color -ri  myproject.php

Putty gets very confused, as does grep.

As I understand it there's probably a way to use an escaped hex code with grep.. does anyone know how?

EDIT: The character is showing up on my web page as a weird <?>. The http headers for the page specify utf-8 as does the meta character set and I still see the strange character. In putty it appears as a space (putty also set to utf-8.) When I copy from vim and paste into grep it simply doesn't find it.

Cheers, John

1
  • In the end I ended up just removing them manually. Oh well :/ – John Hunt Mar 9 '11 at 23:55
2

What you're seeing is the first character of a UTF-8 sequence reinterpreted as another character set. The character isn't actually there per se, the tool you're seeing it in is just confused as to which character set it should be using; tell it to use UTF-8 instead.

0
1

You need to enable UTF-8 in PuTTY. Do this by going to the "Translation" configuration item in putty configuration settings. Change the dropdown entitled: Received data assumed to be in which character set.

2
  • This made the character appear as a space, but google chrome is still displaying it as a <?> diamond character and I still can't grep it. – John Hunt Mar 9 '11 at 22:03
  • This is because Google Chrome can't transcode or display your character. Usually it is because the font does not support your character. – Mircea Vutcovici Mar 9 '11 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.