git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@191637
138bc75d-0d04-0410-961f-
82ee72b054a4
// Turn it into the "replacement character".
v = 0xfffd;
}
+ if (v >= 0xd800 && v < 0xe000)
+ {
+ warning_at(location, 0,
+ "unicode code point 0x%x is invalid surrogate pair", v);
+ v = 0xfffd;
+ }
if (v <= 0xffff)
{
buf[0] = 0xe0 + (v >> 12);
unsigned char *retdata;
struct __go_string ret;
+ /* A negative value is not valid UTF-8; turn it into the replacement
+ character. */
+ if (v < 0)
+ v = 0xfffd;
+
if (v <= 0x7f)
{
buf[0] = v;
"replacement character". */
if (v > 0x10ffff)
v = 0xfffd;
+ /* If the value is a surrogate pair, which is invalid in UTF-8,
+ turn it into the replacement character. */
+ if (v >= 0xd800 && v < 0xe000)
+ v = 0xfffd;
if (v <= 0xffff)
{