feat(libSceCesCs): implement EUC-KR, UHC and Big5 to UTF-8 conversions #8804
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8804"
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 r1p0N on 2026-10-21T01:28:06Z.
What
Adds
sceCesUcsProfileInitEucKr,sceCesUcsProfileInitUhcandsceCesUcsProfileInitBig5Cp950, and replaces the unimplementedsceCesEucKrToUtf8,sceCesUhcToUtf8andsceCesBig5ToUtf8with one-character conversions that followsceCesEucJpToUtf8. Tables: [EucKr.hpp, Uhc.hpp, Big5.hpp], matching Python's euc_kr/cp949/cp950 codecs cell by cell. Console behaviour and signatures are unverified and listed in the libSceCesCs technical debt.Tested
Linux x86-64, GCC 13.3: libSceCesCs sources plus the extended
GuestCes.cpptest compiled directly with-std=c++20 -Wall -Wextra; passes. Also run under AddressSanitizer and UBSan: no reports in the new code. Not built through the full CMake build; not tested on a console or with any title.Note: ASan also reports a pre-existing over-read in
isEucJp(and by the same patternisSjis) when a single-byte profile reachessceCesMbcsStrToUtf8Str; not changed here.Checklist
NotImplemented_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)🤖 Generated with Claude Code
https://claude.ai/code/session_017Tkt8gmGLazgLCTf4MNpkG
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T01:42:23Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)sceCesUcsProfileInitBig5Cp950sceCesUcsProfileInitEucKrsceCesUcsProfileInitUhccore/libs/prx/libSceCesCs/Export.cppL10core/libs/tests/GuestCes.cppL48Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/tests/GuestCes.cppcore/libs/prx/libSceCesCs/Export.cppdocs/dev/debt/libSceCesCs.mdImported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-21T03:18:49Z.
Big5 table decodes a block that CP950 leaves user-defined. Rows C6 and C7 of Big5.hpp map 249 cells in C6A1-C7FC. For example,
sceCesBig5ToUtf8(big5, "\xC6\xA1", 2, ...)returns 0 with U+30FE, and"\xC7\xB1"gives U+0414. Microsoft's CP950.TXT has no entry in that range, and bestfit950.txt marks it EUDC (0xa1 0xf6b1 ;EUDCunder lead byte 0xc6). Apart from these 249 cells, the table equals CP950.TXT: all 13,503 double-byte entries, with the same values.The block comes from CPython. Its
cp950decoder falls back to thebig5map whencp950exthas no entry (_codecs_tw.c). The other user-defined ranges (8140,FA40,C8A1) answerUNASSIGNED_CODE. The debt entry says the tables follow Microsoft's code pages.I would zero those 249 cells, change the count in GuestCes.cpp to 13503, and add
Require(DoubleByteStatus(big5Convert, big5, "\xC6\xA1", 2) == unassignedCode);. If the block is meant to stay, the debt entry should say that C6A1-C7FC follow CPython's big5 table, not CP950.The new profiles silently fail in the MBCS string conversions.
toMbcsandfromMbcsstill accept only the EUC-JP, Shift-JIS and single-byte profiles (Export.cpp#L432, #L459). AftersceCesUcsProfileInitUhc(sheet)andsceCesMbcsUcsContextInit(ctx, sheet), evensceCesMbcsStrToUtf8Str(ctx, "AB", 2, ...)returns0x805C0001, with no log and no throw. EUC-KR and Big5 behave the same, in both directions and in theGet*Lenforms. On main, a title that imports these inits stops at the unresolved import instead.Orbital gives the three inits the same type as
sceCesUcsProfileInitEucJpCp51932:union* (SceCesUcsProfileSheet* sheet)(db_types.json). These functions accept the EUC-JP profile. The debt entry lists this behaviour under Silent stubs, but CONTRIBUTING.md allows a silent stub only when it unblocks a title, and the PR saysUnblocks: none.The decoders already exist.
decodeMbcscan dispatch to them, andfromMbcscan accept the three tags:For the
*ToMbcsStrdirection,toMbcscan use a reverse lookup likejisReverse(), or callNotImplemented_nid_no_patchfor these three profiles until it has one. With that change, the PR's GuestCes test still passes in a local build, and UHCB0A1converts toEA B0 80through the context.Imported from boykopovar/AnyPS5. Originally posted by r1p0N on 2026-10-21T07:14:27Z.
Closing in favor of #7884, which implements the same EUC-KR/UHC/Big5 exports and already covers the MBCS string conversions and Big5 duplicate-cell handling.
Pull request closed