<p>Imagine I have String in C#: "I DonÃ¢â‚¬â„¢t see ya.."</p>

<p>I want to remove (replace to nothing or etc.) these "Ã¢â‚¬â„¢" symbols. </p>

<p>How do I do this?</p>

[{'answer_id': 72698, 'author': 'Gishu', 'author_id': 1695, 'author_profile': 'https://Stackoverflow.com/users/1695', 'pm_score': 0, 'selected': False, 'text': '<p>The ASCII / Integer code for these characters would be out of the normal alphabetic Ranges. Seek and replace with empty characters. String has a Replace method I believe.</p>\n'}, {'answer_id': 72752, 'author': 'itsmatt', 'author_id': 7862, 'author_profile': 'https://Stackoverflow.com/users/7862', 'pm_score': 1, 'selected': False, 'text': '<p>Consider Regex.Replace(your_string, regex, "") - that\'s what I use.</p>\n'}, {'answer_id': 72759, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<pre><code>"I DonÃ¢â‚¬â„¢t see ya..".Replace( "Ã¢â‚¬â„¢", string.Empty);\n</code></pre>\n\n<p>How did that junk get in there the first place?  That\'s the real question.</p>\n'}, {'answer_id': 72770, 'author': 'Phil Wright', 'author_id': 6276, 'author_profile': 'https://Stackoverflow.com/users/6276', 'pm_score': 1, 'selected': False, 'text': '<p>Test each character in turn to see if it is a valid alphabetic or numeric character and if not then remove it from the string. The character test is very simple, just use...</p>\n\n<pre><code>char.IsLetterOrDigit;\n</code></pre>\n\n<p>Please there are various others such as...</p>\n\n<pre><code>char.IsSymbol;\nchar.IsControl;\n</code></pre>\n'}, {'answer_id': 72844, 'author': 'Allan Wind', 'author_id': 9706, 'author_profile': 'https://Stackoverflow.com/users/9706', 'pm_score': 0, 'selected': False, 'text': '<p>Either use a blacklist of stuff you do not want, or preferably a white list (set).  With a white list you iterate over the string and only copy the letters that are in your white list to the result string.  You said remove, and the way you do that is having two pointers one you read from (R) and one you write to (W):</p>\n\n<pre><code>I DonÃ¢â‚\n     W  R\n</code></pre>\n\n<p>if comma is in your whitelist then you would in this case read the comma and write it where Ã is then advance both pointers.  UTF-8 is a multi-byte encoding, so you advancing the pointer may not just be adding to the address.</p>\n\n<p>With C an easy to way to get a white list by using one of the predefined functions (or macros): isalnum,  isalpha,  isascii, isblank, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit.  In this case you send up with a white list function instead of a set of course.</p>\n\n<p>Usually when I see data like you have I look for memory corruption, or evidence to suggest that the encoding I expect is different than the one the data was entered with.</p>\n\n<p>/Allan</p>\n'}, {'answer_id': 72933, 'author': 'willasaywhat', 'author_id': 12234, 'author_profile': 'https://Stackoverflow.com/users/12234', 'pm_score': 2, 'selected': False, 'text': '<p>This looks disturbingly familiar to a character encoding issue dealing with the Windows character set being stored in a database using the standard character encoding. I see someone voted Will down, but he has a point. You may be solving the immediate issue, but the combinations of characters are limitless if this is the issue.</p>\n'}, {'answer_id': 72972, 'author': 'Marc Hughes', 'author_id': 6791, 'author_profile': 'https://Stackoverflow.com/users/6791', 'pm_score': 2, 'selected': False, 'text': '<p>By removing any non-latin character you\'ll be intentionally breaking some internationalization support.</p>\n\n<p>Don\'t forget the poor guy who\'s name has a "â" in it.</p>\n'}, {'answer_id': 72989, 'author': 'Liedman', 'author_id': 890, 'author_profile': 'https://Stackoverflow.com/users/890', 'pm_score': 2, 'selected': False, 'text': "<p>If you really have to do this, regular expressions are probably the best solution.</p>\n\n<p>I would strongly recommend that you think about why you have to do this, though - at least some of the characters your listing as undesirable are perfectly valid and useful in other languages, and just filtering them out will most likely annoy at least some of your international users. As a swede, I can't emphasize enough how much I <i>hate</i> systems that can't handle our å, ä and ö characters correctly.</p>\n"}, {'answer_id': 73302, 'author': 'Mike Dimmick', 'author_id': 6970, 'author_profile': 'https://Stackoverflow.com/users/6970', 'pm_score': 5, 'selected': True, 'text': "<p>That 'junk' looks a lot like someone interpreted UTF-8 data as ISO 8859-1 or Windows-1252, probably repeatedly.</p>\n\n<p>Ã¢â‚¬â„¢ is the sequence C3 A2, E2 82 AC, E2 84 A2.</p>\n\n<ul>\n<li>UTF-8 C3 A2 = U+00E2 = â</li>\n<li>UTF-8 E2 82 AC = U+20AC = €</li>\n<li>UTF-8 E2 84 A2 = U+2122 = ™</li>\n</ul>\n\n<p>We then do it again: in Windows 1252 this sequence is E2 80 99, so the character should have been U+2019, RIGHT SINGLE QUOTATION MARK (’)</p>\n\n<p>You could make multiple passes with byte arrays, Encoding.UTF8 and Encoding.GetEncoding(1252) to correctly turn the junk back into what was originally entered. You will need to check your processing to find the two places that UTF-8 data was incorrectly interpreted as Windows-1252.</p>\n"}, {'answer_id': 73587, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>Regex.Replace("The string", "[^a-zA-Z ]","");</p>\n\n<p>That\'s how you\'d do it in C#, although that regular expression ([^a-zA-Z ]) should work in most languages.</p>\n\n<p>[Edited: forgot the space in the regex]</p>\n'}, {'answer_id': 16419143, 'author': 'Chandra Sekhar k', 'author_id': 2358323, 'author_profile': 'https://Stackoverflow.com/users/2358323', 'pm_score': 0, 'selected': False, 'text': '<p>If String having the any Junk date , This is good to way remove those junk date </p>\n\n<pre><code>     string InputString = "This is grate kingdom¢Ã‚¬â"; \n     string replace = "Ã¢â‚¬â„¢";\n     string OutputString= Regex.Replace(InputString, replace, "");\n\n     //OutputString having the following result \n</code></pre>\n\n<p>It\'s working good to me , thanks for looking this review.</p>\n'}, {'answer_id': 27134222, 'author': 'BrianP007', 'author_id': 4282598, 'author_profile': 'https://Stackoverflow.com/users/4282598', 'pm_score': 0, 'selected': False, 'text': '<p>I had the same problem with extraneous junk thrown in by adobe in an EXIF dump. I spent an hour looking for a straight answer and trying numerous half-baked suggestions which did not work here.</p>\n\n<p>This thread more than most I have read was replete with deep, probing questions like \'how did it get there?\', \'what if somebody has this character in their name?\', \'are you sure you want to break internationalization?\'. </p>\n\n<p>There were some impressive displays of erudition positing how this junk could have gotten here and explaining the evolution of the various character encoding schemes. The person wanted to know how to remove it, not how it came to be or what the standards orgs are up to, interesting as this trivia may be. </p>\n\n<p>I wrote a tiny program which gave me the right answer. Instead of paraphrasing the main concept, here is the entire, self-contained, working (at least on my system) program and the output I used to nuke the junk:</p>\n\n<pre><code>#!/usr/local/bin/perl -w\n\n# This runs in a dos window and shows the char, integer and hex values\n# for the weird chars. Install the HEX values in the REGEXP below until\n# the final test line looks normal. \n$str = \'s: â€œBrian\';  # Nuke the 3 werid chars in front of Brian.\n@str = split(//, $str);\nprintf("len str \'$str\' = %d, scalar \\@str = %d\\n", \n    length $str, scalar @str);\n$ii = -1;\nforeach $c (@str)  {\n   $ii++;\n   printf("$ii) char \'$c\', ord=%03d, hex=\'%s\'\\n", \n       ord($c), unpack("H*", $c));\n}\n# Take the hex characters shown above, plug them into the below regexp\n# until the junk disappears!\n($s2 = $str) =~ s/[\\xE2\\x80\\x9C]//g;  # &lt;&lt; Insert HEX values HERE\nprint("S2=&gt;$s2&lt;\\n");  # Final test\n\nResult:\nM:\\new\\6s-2014.1031-nef.halloween&gt;nuke_junk.pl\nlen str \'s: GÇ£Brian\' = 11, scalar @str = 11\n0) char \'s\', ord=115, hex=\'73\'\n1) char \':\', ord=058, hex=\'3a\'\n2) char \' \', ord=032, hex=\'20\'\n3) char \'G\', ord=226, hex=\'e2\'\n4) char \'Ç\', ord=128, hex=\'80\'\n5) char \'£\', ord=156, hex=\'9c\'\n6) char \'B\', ord=066, hex=\'42\'\n7) char \'r\', ord=114, hex=\'72\'\n8) char \'i\', ord=105, hex=\'69\'\n9) char \'a\', ord=097, hex=\'61\'\n10) char \'n\', ord=110, hex=\'6e\'\nS2=&gt;s: Brian&lt;\n</code></pre>\n\n<p>It\'s NORMAL!!!</p>\n\n<p>One other actionable, working suggestion I ran across:\n    iconv -c -t ASCII &lt; 6s-2014.1031-238246.halloween.exf.dif > exf.ascii.dif</p>\n'}]
['https://Stackoverflow.com/questions/72677', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5369/']