fix(core): Streamlines text encoding (#407)

- [X] Streamlines text encoding
This commit is contained in:
Kamron Batman 2021-01-13 18:56:32 -08:00 committed by GitHub
parent 5631c1da6d
commit 211c2ba8ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 274 additions and 137 deletions

View file

@ -6,6 +6,7 @@ using Server.ContextMenus;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Text;
namespace Server.Items
{
@ -501,7 +502,7 @@ namespace Server.Items
for (var j = 0; j < page.Lines.Length; ++j)
{
var buffer = Utility.UTF8.GetBytes(page.Lines[j]);
var buffer = page.Lines[j].GetBytesUtf8();
Stream.Write(buffer, 0, buffer.Length);
Stream.Write((byte)0);
@ -517,8 +518,8 @@ namespace Server.Items
var title = book.Title ?? "";
var author = book.Author ?? "";
var titleBuffer = Utility.UTF8.GetBytes(title);
var authorBuffer = Utility.UTF8.GetBytes(author);
var titleBuffer = title.GetBytesUtf8();
var authorBuffer = author.GetBytesUtf8();
EnsureCapacity(15 + titleBuffer.Length + authorBuffer.Length);