feat(icu4c): Add ICU4C support to UTF8 string operations - #3187
feat(icu4c): Add ICU4C support to UTF8 string operations#3187CryoTheRenegade wants to merge 5 commits into
Conversation
PR Summary by QodoAdd ICU4C-backed UTF-8 conversions and link ICU into the engine
AI Description
Diagram
High-Level Assessment
Files changed (13)
|
Code Review by Qodo
1.
|
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 0240a44 |
|
@greptileai review this |
|
| Filename | Overview |
|---|---|
| cmake/icu.cmake | Adds the shared ICU interface target and selects package, Windows SDK, dynamic-loading, or required non-Windows behavior. |
| Core/Libraries/Source/WWVegas/WWLib/utf8.cpp | Replaces hand-written transcoding with ICU-backed implementations and Win32 fallback paths while preserving malformed-input signaling. |
| Core/GameEngine/Source/Common/System/AsciiString.cpp | Converts wide strings to UTF-8 through the shared API and guards the destination-size limit. |
| Core/GameEngine/Source/Common/System/UnicodeString.cpp | Converts valid UTF-8 through the shared API while retaining the legacy byte-wise fallback for invalid input. |
| Core/GameEngine/Source/GameNetwork/GameInfo.cpp | Truncates serialized LAN player names without retaining partial UTF-8 sequences. |
| Core/GameEngine/Source/GameNetwork/GameSpy/Thread/ThreadUtils.cpp | Moves GameSpy text conversion to the shared UTF-8 API and preserves single-line normalization. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Build[CMake ICU selection] --> Package[System or vcpkg ICU]
Build --> WinSDK[Windows SDK ICU]
Build --> Dynamic[Legacy dynamic icu.dll]
Dynamic --> Win32[Win32 UTF-8 fallback]
Package --> Shared[WWLib UTF-8 conversion API]
WinSDK --> Shared
Dynamic --> Shared
Win32 --> Shared
Shared --> Strings[AsciiString and UnicodeString]
Shared --> GameSpy[GameSpy string helpers]
GameSpy --> LAN[UTF-8-safe LAN name truncation]
Reviews (2): Last reviewed commit: "fix(icu): Use InterlockedIncrement for t..." | Re-trigger Greptile
Use vcpkg or the Windows SDK C API on modern builds, keep VC6 on runtime LoadLibrary, and only probe system icu.dll for the delay-loaded SDK path.
Preserve bobtista's original change comments and append the ICU conversion notes instead of replacing them.
Publish the availability result with InterlockedCompareExchange, search the normal DLL path instead of System32 only, and pass the CMake-found icu.lib into the link line.
Avoid InterlockedCompareExchange, whose VC6 and later SDK signatures disagree, so utf8.cpp compiles on both toolchains.
0240a44 to
c27b37a
Compare
|
To use Codex here, create a Codex account and connect to github. |
|
@codex review this |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Replaces the hand-rolled WWLib UTF-8 converter with ICU4C, and links ICU into the engine so later code can use the rest of the suite.
AsciiString::translate/UnicodeString::translatenow convert through ICU instead of 7-bit ASCII. Invalid UTF-8 still falls back to the original one-byte-to-one-wide-unit behavior so legacy CP1252 data is preserved. LAN player names are truncated on a UTF-8 code-point boundary instead of chopping mid-sequence.ICU is selected in this order:
find_package(ICU)from vcpkg / system (C and C++ APIs)icu.lib+/DELAYLOAD:icu.dllon modern MSVCLoadLibraryof OSicu.dll, with Win32CP_UTF8if that DLL is missingWWLib/IcuSupport.his the engine include for linked ICU. vcpkg now depends onicuon all platforms.In the future we can also use ICU's baked in bidirectional string support for languages that require them