Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

migrated from serverfault.com Mar 10 '11 at 9:37

This question came from our site for professional system and network administrators.

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

2 Answers 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.

share|improve this answer

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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