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
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.
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.
|
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.
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 0240a44 |
|
@greptileai review this |
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WWLib/utf8.cpp | Replaces manual UTF-8 transcoding with platform-selected ICU or Win32 implementations and retains malformed-input signaling. |
| cmake/icu.cmake | Defines the shared ICU interface target and selects package, Windows SDK, or dynamic Windows integration. |
| Core/GameEngine/Source/GameNetwork/GameInfo.cpp | Changes LAN player-name truncation to retain only complete UTF-8 code points. |
| Core/GameEngine/Source/Common/System/AsciiString.cpp | Converts wide strings to UTF-8 using measured allocation and enforces the string-length ceiling. |
| Core/GameEngine/Source/Common/System/UnicodeString.cpp | Uses ICU-backed UTF-8 decoding while preserving the legacy byte-cast fallback for malformed input. |
| Core/GameEngine/Source/GameNetwork/GameSpy/Thread/ThreadUtils.cpp | Moves GameSpy text conversion to shared UTF-8 helpers and safely normalizes line breaks. |
| vcpkg.json | Adds ICU as a package-managed dependency for vcpkg builds. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Input[UTF-8 or wide input] --> Available{Linked or dynamically loaded ICU available?}
Available -- Yes --> ICU[Convert through ICU4C]
Available -- No, Windows --> Win32[Convert through Win32 CP_UTF8]
Available -- No, non-Windows --> Failure[Report conversion failure]
ICU --> Valid{Valid UTF-8 input?}
Win32 --> Valid
Valid -- Yes --> Output[Return converted text]
Valid -- No --> Legacy[Caller preserves bytes as wide units]
Reviews (1): Last reviewed commit: "fix(icu): Use InterlockedIncrement for t..." | Re-trigger Greptile
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.