Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@@ -187,8 +187,10 @@ namespace I18N.CJK
startIgnore = m.GEnd + 1;
}
}
// return ToUcsRaw ((int) (linear - gbxBase));
throw new SystemException (String.Format ("GB18030 INTERNAL ERROR (should not happen): GBX {0:x02} {1:x02} {2:x02} {3:x02}", b1, b2, b3, b4));
// All 4 bytes look valid but we didn't find any appropriate range.
// So just return negative result for it.
return -4;
}
public static long FromUCSSurrogate (int cp)
@@ -212,7 +214,9 @@ namespace I18N.CJK
startIgnore = m.UEnd + 1;
}
}
throw new SystemException (String.Format ("GB18030 INTERNAL ERROR (should not happen): UCS {0:x06}", cp));
// Consider it as invalid character
return -1;
}
static long FromGBXRaw (

View File

@@ -597,5 +597,13 @@ namespace MonoTests.I18N.CJK
}
#endregion
[Test]
public void Bug13144 ()
{
var encoding = Encoding.GetEncoding ("GB18030");
var str = encoding.GetString (new byte[] { 0x84, 0x32, 0x81, 0x30 });
Assert.AreEqual ("?", str);
}
}
}