IsUnicode
IsUnicode
Source
public static bool IsUnicode(this string value)
{
int asciiBytesCount = System.Text.Encoding.ASCII.GetByteCount(value);
int unicodBytesCount = System.Text.Encoding.UTF8.GetByteCount(value);
if (asciiBytesCount != unicodBytesCount)
{
return true;
}
return false;
}
Example
bool isUnicode = "سید مهدی میری".IsUnicode();