Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
try:
s.decode('utf8')
b = True
except UnicodeError:
b = False
b = s.force_encoding("UTF-8").valid_encoding?
let b = std::str::from_utf8(&bytes).is_ok();