is-unicode-supported
Detect whether the terminal supports unicode or not. Inspiration comes from sindresorhus/is-unicode-supported. Useful for deciding whether to use Unicode or ASCII characters in command-line output.
Words from Sindre:
Note that the check is quite naive. It just assumes all non-Windows terminals support Unicode and hard-codes which Windows terminals that do support Unicode. However, I have been using this logic in some popular packages for years without problems.
Usage
$> cargo add is-unicode-supported
main.rs
use is_unicode_supported::is_unicode_supported;
fn main() {
if is_unicode_supported() {
println!("Unicode is supported here!!! ๐ฆ๐ฆ๐ฆ");
} else {
println!("Unicode is not supported here! ;(");
}
}