From: Mikko Rasa Date: Tue, 4 Sep 2012 06:46:19 +0000 (+0300) Subject: Refuse to encode invalid Unicode characters in UTF-8 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=8245b8036c8bdc51625616ca6248b0f2b0271dc0;p=libs%2Fcore.git Refuse to encode invalid Unicode characters in UTF-8 --- diff --git a/source/stringcodec/utf8.cpp b/source/stringcodec/utf8.cpp index c6d1990..b75b397 100644 --- a/source/stringcodec/utf8.cpp +++ b/source/stringcodec/utf8.cpp @@ -7,7 +7,7 @@ namespace StringCodec { void Utf8::Encoder::encode_char(unichar ch, string &buf) { - if(ch<0 || ch>0x10FFFF) + if(!is_valid_unichar(ch)) return error(ch, buf, invalid_character(ch, "UTF-8")); unsigned bytes = 1;