IsUnicode

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();

Description

IsUnicode

Details

Double click on the code to select all.

 

;