Make sure to write the correct number of bytes, as UTF8 can and most likely will be more than one byte per char.

Fixes #863
This commit is contained in:
Zack 2015-02-22 16:07:59 -05:00
parent d82851faf3
commit 68afd6fcc6

View file

@ -157,7 +157,8 @@ namespace Rests
e.Response.Connection.Type = ConnectionType.Close;
e.Response.ContentType = new ContentTypeHeader("application/json; charset=utf-8");
e.Response.Add(serverHeader);
e.Response.Body.Write(Encoding.UTF8.GetBytes(str), 0, str.Length);
var bytes = Encoding.UTF8.GetBytes(str);
e.Response.Body.Write(bytes, 0, bytes.Length);
e.Response.Status = HttpStatusCode.OK;
}