1 #include "llvm/Support/Locale.h"
2 #include "llvm/Support/Unicode.h"
8 int columnWidth(StringRef Text) {
12 return llvm::sys::unicode::columnWidthUTF8(Text);
16 bool isPrint(int UCS) {
18 // Restrict characters that we'll try to print to the the lower part of ASCII
19 // except for the control characters (0x20 - 0x7E). In general one can not
20 // reliably output code points U+0080 and higher using narrow character C/C++
21 // output functions in Windows, because the meaning of the upper 128 codes is
22 // determined by the active code page in the console.
23 return ' ' <= UCS && UCS <= '~';
25 return llvm::sys::unicode::isPrintable(UCS);