feat(libSceIcu): encode UTF-16 copies with the default converter #25957
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/25957"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ynkmyz233 on 2026-11-23T00:58:27Z.
What
Complete Unicode-to-default-encoding support in
u_austrcpyandu_austrncpy. Both now encode UTF-16 using the bundled ICU default converter, under the same lock that protects changes to the default encoding. The bounded function limits both the number of source code units read and the number of output bytes written. It writes one terminator when space permits.#22132 touches the former implementations in
Invariant.cppto check guest pointers and keeps their ASCII input limit. This PR moves those two exports next to the default converter and adds the missing encoding behavior.Tested
Windows 10 x64 (19045), MinGW-w64 GCC 15.2.0, Release. Passed
guest_icu_converter_helpers,guest_icu_version, andguest_icu_converter_file_separator. Tested UTF-8 output for accented and supplementary characters, encoded bytes truncated within a character, exact capacity, a bounded input without a terminator, more than one conversion chunk, and switching the default to ISO-8859-1. The existing ASCII copy coverage also ran.Passed
tools/check_conventions.py --base origin/main,tools/debt_fold.py --check, and the public-header audit. Console behavior remains unverified.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-23T00:59:34Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
f06aa4009a:tools/check_conventions.pypassed.guest_icu_converter_helpers_testsbuilt cleanly.guest_icu_converter_helpers):core/libs/prx/libSceIcu/ConverterHelpers.cpp,core/libs/prx/libSceIcu/Invariant.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T01:25:59Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: bounded copies currently choose a byte capacity from the UTF-16 unit count, which can prevent termination when the encoding expands characters.
What I ran
f06aa4009a50c7da9c53d71d35431384fd5241a5against basemain; no merged-preview check was run.repo_read.py.Results
Findings
Blocking
core/libs/prx/libSceIcu/ConverterHelpers.cpp:230:u_austrncpypasses the UTF-16 unit count as the output byte capacity. With a positive count of 1 and a source containing one character that encodes to multiple bytes (for example,éunder UTF-8), ICU writes only the first encoded byte and returns overflow; because no output space remains, the function emits no terminator. The documented bounded behavior requires a terminator when space permits, but more generally this does not match ICU's bounded copy semantics: the count bounds input units while converted output may exceed that capacity, and the API has no destination-size parameter. Confirm the intended semantics and implement the bounded conversion accordingly; add a case that checks the required output and termination behavior for an expanding encoding.Non-blocking
None.
Sources
Not verified
files.jsonwas not available in the prepared review folder; the manifest lists five changed files, all of which were read. No excluded-file list could be confirmed.To get this to a good state
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T10:38:21Z.
Review: COMMENTED
The GuestIcuConverterHelpers fixture coverage passed on Linux with the exact implementation from this head. The fixture covers bounded input, chunked output, termination and the selected default encoding.
AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.