string.Replace does not work on Unicode characters & ldquo; â ~ ... & rdquo;


I'm trying to convert the following string:

★ Bayonet | Slaughter (Minimal Wear)

To simply:

Bayonet | Slaughter (Minimal Wear)

To do this I am trying to use the following: (name is the string containing the above)

name = name.Replace("★ ", "");

However, the string remains unchanged. I am retrieving the string using a JSON response which appears to suggest that strange text(a star symbol) is made using the following sequence:


However, the string seems to be automatically converted to that strange string at the top of the post. So why does the name.replace function not work to replace those characters?

It's probably an encoding problem. In the C# part, I'm suggesting you to try to write :

name = name.Replace("\u2605", string.Empty);

Rather than to hard-code the correspondant character. .Net will take care of the \u2605 for you.