Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 Unicode gets double escaped when serializing to json #334

Closed
1 task done
lprichar opened this issue Sep 30, 2022 · 0 comments · May be fixed by #335
Closed
1 task done

🐞 Unicode gets double escaped when serializing to json #334

lprichar opened this issue Sep 30, 2022 · 0 comments · May be fixed by #335
Assignees
Labels
bug Something isn't working triage Waiting to be triaged

Comments

@lprichar
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

.ToJson() converts ú to \\u00f

Expected Behavior

.ToJson() should convert ú to \u00f

Steps To Reproduce

The following test should pass:

[Test]
public void Test_Unicode_CandidateNames()
{
    var candidateName = new Language("Raúl", "en");
    var candidate = new Candidate(
        "candidate-1",
        new InternationalizedText(new[] { candidateName }),
        string.Empty,
        string.Empty,
        false);

    List<Candidate> candidates = new List<Candidate>
    {
        candidate
    };

    var result = new Manifest(
        "test-manifest",
        ElectionType.general,
        DateTime.Now,
        DateTime.Now,
        new GeopoliticalUnit[] { },
        new Party[] { },
        candidates.ToArray(),
        new ContestDescription[] { },
        new BallotStyle[] { },
        new InternationalizedText(new Language[] { }),
        new ContactInformation("na"));

    var json = result.ToJson();
    Assert.IsTrue(json.Contains("\"value\":\"Ra\\u00fal\""));
}

Environment

- OS:

Anything else?

No response

@lprichar lprichar added bug Something isn't working triage Waiting to be triaged labels Sep 30, 2022
@lprichar lprichar self-assigned this Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Waiting to be triaged
Projects
None yet
1 participant