feat: Adds Latin1 (filtered CP1252) support. Optimizes ASCII/UTF8/16 support#2317
Merged
kamronbatman merged 1 commit intomainfrom Jan 22, 2026
Merged
feat: Adds Latin1 (filtered CP1252) support. Optimizes ASCII/UTF8/16 support#2317kamronbatman merged 1 commit intomainfrom
kamronbatman merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Latin1 (with filtering of C0/C1 control codes) as a supported encoding across multiple UO network packet read/write paths, and introduces optimized encoding/decoding helpers.
Changes:
- Switches many “ASCII” packet fields to Latin1 equivalents (ReadLatin1*/WriteLatin1*), including gumps, menus, vendors, and speech.
- Refactors
SpanReaderto use encoding-specific read paths and adds Latin1 read helpers. - Extends
TextEncodingwith optimized, filtered decoding methods for ASCII/Latin1/UTF-8/UTF-16.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Projects/UOContent/Network/Packets/IncomingPlayerPackets.cs | Reads prompt response text as Latin1-safe. |
| Projects/UOContent/Network/Packets/IncomingMobilePackets.cs | Reads rename request text as Latin1-safe. |
| Projects/UOContent/Network/Packets/IncomingMessagePackets.cs | Reads ASCII speech text as Latin1-safe. |
| Projects/UOContent/Network/Packets/IncomingAccountPackets.cs | Reads character/account/game login fields as Latin1. |
| Projects/UOContent/Items/Games/Mahjong/MahjongPackets.cs | Writes Mahjong player names as Latin1. |
| Projects/UOContent/Items/Books/BookPackets.cs | Reads legacy book title/author as Latin1-safe. |
| Projects/UOContent/Gumps/Base/RelayInfo.cs | Uses TextEncoding.GetStringBigUni for gump text entries. |
| Projects/UOContent/Gumps/Base/OutgoingGumpPackets.cs | Writes sign gump strings as Latin1 null-terminated. |
| Projects/UOContent/Gumps/Base/Legacy/GumpTooltip.cs | Writes tooltip layout using Latin1 when args are present. |
| Projects/UOContent/Gumps/Base/Legacy/GumpHtmlLocalized.cs | Writes localized HTML token args using Latin1. |
| Projects/UOContent/Gumps/Base/GumpLayoutBuilder.cs | Encodes layout values using Latin1 bytes. |
| Projects/Server/Text/TextEncoding.cs | Adds optimized ASCII/Latin1/UTF-8/UTF-16 decoding with filtering + Latin1 helpers. |
| Projects/Server/Server.csproj | Bumps System.IO.Hashing package version. |
| Projects/Server/Network/Packets/OutgoingVendorSellPackets.cs | Writes vendor sell item names as Latin1. |
| Projects/Server/Network/Packets/OutgoingVendorBuyPackets.cs | Writes vendor buy descriptions as Latin1 null-terminated. |
| Projects/Server/Network/Packets/OutgoingSecureTradePackets.cs | Writes secure trade name as Latin1 fixed-length. |
| Projects/Server/Network/Packets/OutgoingPlayerPackets.cs | Writes profile header/paperdoll title/scroll text as Latin1. |
| Projects/Server/Network/Packets/OutgoingMobilePackets.cs | Writes mobile names/status names as Latin1 fixed-length. |
| Projects/Server/Network/Packets/OutgoingMessagePackets.cs | Writes message “ascii” branch fields using Latin1. |
| Projects/Server/Network/Packets/OutgoingMenuPackets.cs | Writes menu questions/answers as Latin1. |
| Projects/Server/Network/Packets/OutgoingEquipmentPackets.cs | Writes crafter name as Latin1. |
| Projects/Server/Network/Packets/OutgoingAccountPackets.cs | Writes character/server list strings as Latin1. |
| Projects/Server/Main.cs | Registers code page provider at setup time. |
| Projects/Server/Buffers/SpanWriter.cs | Adds Latin1/CP1252 write helpers and Latin1 null-terminated writes. |
| Projects/Server/Buffers/SpanReader.cs | Adds Latin1 read helpers and uses encoding-specific read methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2c2d412 to
e518a22
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
the UO client renders nothing for these characters
Changes
TextEncoding.cs
GetStringLittleUni
SpanReader.cs
SpanWriter.cs
Packet Updates
trade packets, vendor packets, gump packets, book packets, mahjong packets
Filtering Behavior
Invalid characters filtered in safe mode:
Note: Surrogate pairs (0xD800-0xDFFF) are not filtered because proper validation requires context checking for paired
vs unpaired surrogates. The UO client renders nothing for these anyway.
Test Plan