#ifndef CPPLOCALE_H #define CPPLOCALE_H // cpplocale.h // 9/26/2014 jichi #include #include //#include // See: http://stackoverflow.com/questions/20195262/how-to-read-an-utf-8-encoded-file-containing-chinese-characters-and-output-them // The same as boost::locale::generator().generate("UTF-8"), which require linking // See: http://en.cppreference.com/w/cpp/locale/codecvt_utf8 // - 0x10ffff is the default maximum value. // - std::consume_header will skip the leading encoding byte from the input. template inline std::locale cpp_utf8_locale(std::locale init = std::locale()) { return std::locale(init, new std::codecvt_utf8()); } #endif // CPPLOCALE_H