Charset.canEncode

bool canEncode(string charset, string text)

Check to see if the UTF-8 text will fit safely within charset.

Parameters

charseta charset
textutf-8 text to check

Returns

true if it is safe to encode text into charset or false

otherwise.