Skip to content

Json Serialize for non-unicode #5

@somchai-devtination

Description

@somchai-devtination

I try to use this connector with instance.SetValuesFrom and found a problem that non-Ascii text will lose data because Newtonsoft will serialize with UTF8 and after send to native it will ruin.

I would like to request update Instance.cs for serialize for JSON from
public void SetValuesFrom(object obj)
{
instance.SetJson(JsonConvert.SerializeObject(obj));
}

with

    public void SetValuesFrom(object obj)
    {
        JsonSerializerSettings ss = new JsonSerializerSettings();
        ss.StringEscapeHandling = StringEscapeHandling.EscapeNonAscii;
        ss.Formatting = Formatting.None;
        instance.SetJson(JsonConvert.SerializeObject(obj, ss));
    }

that will escape non-Ascii with \uXXXX format.

so please update the code.

thank

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions