Change output of REST to UTF8, which is what Terraria uses behind the scenes. Also changed content type to include the encoding. Fixes #858

This commit is contained in:
Zack 2015-02-21 19:00:57 -05:00
parent 3104e76d21
commit f8a513d9da

View file

@ -155,9 +155,9 @@ namespace Rests
str = string.Format("{0}({1});", jsonp, str); str = string.Format("{0}({1});", jsonp, str);
} }
e.Response.Connection.Type = ConnectionType.Close; e.Response.Connection.Type = ConnectionType.Close;
e.Response.ContentType = new ContentTypeHeader("application/json"); e.Response.ContentType = new ContentTypeHeader("application/json; charset=utf-8");
e.Response.Add(serverHeader); e.Response.Add(serverHeader);
e.Response.Body.Write(Encoding.ASCII.GetBytes(str), 0, str.Length); e.Response.Body.Write(Encoding.UTF8.GetBytes(str), 0, str.Length);
e.Response.Status = HttpStatusCode.OK; e.Response.Status = HttpStatusCode.OK;
} }