Unescape JSON string token before transcoding to UTF-16 and returning to the user...
authorAhson Khan <ahkha@microsoft.com>
Sat, 19 Jan 2019 14:37:57 +0000 (06:37 -0800)
committerGitHub <noreply@github.com>
Sat, 19 Jan 2019 14:37:57 +0000 (06:37 -0800)
commit7e6f6d0f0e5e2f25755749ce6aca3b5e01551666
tree2133ecc87b644788b9b785ce6c3dfd5285519e4f
parent715839069e4e352a930ba900d72e9700628bfb66
Unescape JSON string token before transcoding to UTF-16 and returning to the user. (dotnet/corefx#34636)

* Unescape JSON string token before transcoding to UTF-16 and returning to
the user.

* Handle escaping and transcoding surrogate pairs correctly.

* Fix unescaping forward slash.

* Add a double high surrogate test.

* Factor out common helpers between the reader and writer.

* Fix exception messages.

* Fix build issues related to source package.

* Add comments regarding Debug.Asserts and fix InRange impl.

* Dont throw DecoderFallBackException and add invalid utf-8 string tests.

* Wrap the DecoderfallbackException within the InvalidOperationException.

Commit migrated from https://github.com/dotnet/corefx/commit/38e5e28646687da306ad1f3e3fc9876e67e031bb
12 files changed:
src/libraries/System.Text.Json/src/Resources/Strings.resx
src/libraries/System.Text.Json/src/System.Text.Json.csproj
src/libraries/System.Text.Json/src/System/Text/Json/JsonConstants.cs
src/libraries/System.Text.Json/src/System/Text/Json/JsonHelpers.cs [new file with mode: 0644]
src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.Unescaping.cs [new file with mode: 0644]
src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.cs
src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.TryGet.cs
src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterHelper.Escaping.cs
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterHelper.Transcoding.cs
src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs
src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.cs