diff --git a/concordia/common/text_utils.cpp b/concordia/common/text_utils.cpp index c7704bd..91049de 100644 --- a/concordia/common/text_utils.cpp +++ b/concordia/common/text_utils.cpp @@ -2,6 +2,8 @@ #include #include #include +#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); }