X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=inline;f=source%2Fstringcodec%2Futf8.cpp;h=4c75d8b073e277c2adc2f38db5f3db806da7b0e5;hb=9a79b9ca04d934e8e5b865a1d2b6719f76ec9d15;hp=b0431eb4f49e3d595ddefd44e5dfca57e421d060;hpb=3e3868860d4f4ca1bbe55fbf271c804307cea3c9;p=libs%2Fcore.git diff --git a/source/stringcodec/utf8.cpp b/source/stringcodec/utf8.cpp index b0431eb..4c75d8b 100644 --- a/source/stringcodec/utf8.cpp +++ b/source/stringcodec/utf8.cpp @@ -37,7 +37,7 @@ void Utf8::Encoder::encode_char(unichar ch, string &buf) void Utf8::Encoder::transliterate(unichar, string &buf) { - buf.append("\357\277\275", 3); // � U+FFFE Replacement Character + buf.append("\357\277\275", 3); // � U+FFFD Replacement Character } @@ -71,7 +71,7 @@ unichar Utf8::Decoder::decode_char(const string &str, string::const_iterator &i) result = error("Incomplete UTF-8 character"); else if(!(result>>(bytes*5-4)) || !(result>>7)) result = error("Denormalized UTF-8 multibyte sequence"); - else if(result>0x10FFFF || (result>=0xD800 && result<=0xDFFF)) + else if(!is_valid_unichar(result)) result = error("Invalid Unicode code point"); i = j;