Skip to content

Commit

Permalink
Add UTF8 Support on Tiledata
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhobean committed Nov 1, 2024
1 parent 38b534d commit ec52029
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Ultima/Helpers/TileDataHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static unsafe string ReadNameString(byte* buffer)
_stringBuffer[count] = *buffer++;
}

return Encoding.ASCII.GetString(_stringBuffer, 0, count);
return Encoding.UTF8.GetString(_stringBuffer, 0, count);
}

public static string ReadNameString(byte[] buffer, int len)
Expand All @@ -38,7 +38,7 @@ public static string ReadNameString(byte[] buffer, int len)
//;
}

return Encoding.ASCII.GetString(buffer, 0, count);
return Encoding.UTF8.GetString(buffer, 0, count);
}

public static int ConvertStringToInt(string text)
Expand Down
4 changes: 2 additions & 2 deletions Ultima/TileData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ public static void SaveTileData(string fileName)
var b = new byte[20];
if (LandTable[i].Name != null)
{
byte[] bb = Encoding.ASCII.GetBytes(LandTable[i].Name);
byte[] bb = Encoding.UTF8.GetBytes(LandTable[i].Name);
if (bb.Length > 20)
{
Array.Resize(ref bb, 20);
Expand Down Expand Up @@ -1464,7 +1464,7 @@ public static void SaveTileData(string fileName)
var b = new byte[20];
if (ItemTable[i].Name != null)
{
byte[] bb = Encoding.ASCII.GetBytes(ItemTable[i].Name);
byte[] bb = Encoding.UTF8.GetBytes(ItemTable[i].Name);
if (bb.Length > 20)
{
Array.Resize(ref bb, 20);
Expand Down

0 comments on commit ec52029

Please sign in to comment.