ensuring UTF-8 strings
This commit is contained in:
parent
61631c52a3
commit
bd4ff81e32
@ -2,6 +2,8 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/locale.hpp>
|
||||
#include "utf8/utf8.h"
|
||||
|
||||
|
||||
TextUtils::TextUtils() {
|
||||
_lowerConverter =
|
||||
@ -11,6 +13,9 @@ TextUtils::TextUtils() {
|
||||
}
|
||||
|
||||
std::string TextUtils::toLowerCase(const std::string & text) {
|
||||
if (!utf8::is_valid(text.begin(), text.end())) {
|
||||
throw ConcordiaException("Bad input encoding, use UTF-8");
|
||||
}
|
||||
return simpleConvert(*_lowerConverter, text);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user