From f8a513d9da5f4a51e117dbbe6a207b0bf12bb364 Mon Sep 17 00:00:00 2001 From: Zack Date: Sat, 21 Feb 2015 19:00:57 -0500 Subject: [PATCH] Change output of REST to UTF8, which is what Terraria uses behind the scenes. Also changed content type to include the encoding. Fixes #858 --- TShockAPI/Rest/Rest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Rest/Rest.cs b/TShockAPI/Rest/Rest.cs index c23d0552..4fbf94e4 100644 --- a/TShockAPI/Rest/Rest.cs +++ b/TShockAPI/Rest/Rest.cs @@ -155,9 +155,9 @@ namespace Rests str = string.Format("{0}({1});", jsonp, str); } 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.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; }