Skip to content

Commit

Permalink
Disable encoding special characters for test data
Browse files Browse the repository at this point in the history
  • Loading branch information
sliekens committed Oct 30, 2024
1 parent db2b301 commit a873fb8
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions GW2SDK.TestDataHelper/JsonDocumentEx.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using System.Text.Json;
using System.Text.Encodings.Web;
using System.Text.Json;

namespace GuildWars2.TestDataHelper;

internal static class JsonDocumentEx
{
private static readonly JsonWriterOptions WithoutIndented = new() { Indented = false };
// UnsafeRelaxedJsonEscaping is used to preserve special characters in the output
// Otherwise, they would be escaped as \uXXXX sequences which is a safety measure for web content but not necessary for test data
private static readonly JsonWriterOptions WithoutIndented = new() { Indented = false, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };

private static readonly JsonWriterOptions WithIndented = new() { Indented = true };
private static readonly JsonWriterOptions WithIndented = new() { Indented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };

internal static JsonDocument Indent(this JsonDocument json, bool indent = true)
{
Expand Down
Binary file modified GW2SDK.Tests/Data/achievements.json.gz
Binary file not shown.
Binary file modified GW2SDK.Tests/Data/decorations.json.gz
Binary file not shown.
Binary file modified GW2SDK.Tests/Data/items.json.gz
Binary file not shown.
Binary file modified GW2SDK.Tests/Data/recipes.json.gz
Binary file not shown.
Binary file modified GW2SDK.Tests/Data/skins.json.gz
Binary file not shown.

0 comments on commit a873fb8

Please sign in to comment.