This is not the serializer causing this problem; Json.Net does a great job with foreign characters. Most likely, you will do one of the following:
- ( ) JSON . ,
Encoding.UTF8. - JSON
varchar , nvarchar. varchar Unicode. - JSON , , / , . Windows, , , .
, , . JSON, UTF-8, . . "default" ? . UTF-8 , . ( , "" "Arial Unicode MS".)
, JSON Visual Studio; , JSON json.
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
class Program
{
static void Main(string[] args)
{
List<Foo> foos = new List<Foo>
{
new Foo { Language = "Hebrew", Sample = "אספירין" },
new Foo { Language = "Hindi", Sample = "एस्पिरि" },
new Foo { Language = "Chinese", Sample = "阿司匹林" },
new Foo { Language = "Japanese", Sample = "アセチルサリチル酸" },
};
var json = JsonConvert.SerializeObject(foos, Formatting.Indented);
File.WriteAllText("utf8.json", json, Encoding.UTF8);
File.WriteAllText("default.json", json, Encoding.Default);
}
}
class Foo
{
public string Language { get; set; }
public string Sample { get; set; }
}