What is the best way to check if string contains specified Unicode character? My problem is I cannot parse string/characters to format \u[byte][byte][byte][byte]. I followed many tutorials and threads here on StackOverflow, but when I have method like this one:
private bool ContainsInvalidCharacters(string name)
{
if (translation.Any(c => c > 255))
{
byte[] bytes = new byte[name.Length];
Buffer.BlockCopy(name.ToCharArray(), 0, bytes, 0, bytes.Length);
string decoded = Encoding.UTF8.GetString(bytes, 0, name.Length);
(decoded.Contains("\u0001"))
{
//do something
}
}
I get output like: "c\0o\0n\0t\0i\0n\0g\0u\0t\0".
This really is not my cup of tea. I will be grateful for any help.