Improved dbcs file api handling#592
Open
1000TurquoisePogs wants to merge 2 commits into
Open
Conversation
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
|
6 tasks
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.



Proposed changes
Fix the default target encoding used when serving USS file content via
respondWithUnixFile2()inhttpserver.c. Previously, on z/OS the target was hardcoded to ISO-8859-1 (819) for all text-type files regardless of their tagged CCSID. This corrupted content from files tagged as UTF-8 (1208), UTF-16 (1200/1201/1202), or any EBCDIC MIX code page (930, 933, 935, 937, 939, 1364, 1388, 1390, 1399).The fix introduces
isMultiByteCCSID(int ccsid)incharsets.c/charsets.hand uses it at runtime to select the target:The OS-based
#ifdefTBD comment is replaced with this runtime selection on z/OS. Non-z/OS platforms (Linux, AIX, Windows) continue to use UTF-8 as before.Type of change
PR Checklist
Testing
Manual test — UTF-8 tagged file:
chtag -tc 1208 <file>/unixFileContents/<path>with no query parameters.Regression — IBM-1047 tagged file:
/unixFileContents/<path>.Regression — untagged file:
chtag -b <file>to remove tag, or leave untagged)./unixFileContents/<path>.Unit test —
isMultiByteCCSID():Further comments
The original code contained an explicit TBD comment acknowledging that the OS-based selection "isn't really an OS dependency". This PR resolves that TBD by selecting the target encoding at runtime based on
isMultiByteCCSID().The
isMultiByteCCSID()function is intentionally conservative: it covers the Unicode encodings and the EBCDIC MIX (SBCS+DBCS) code pages that are realistic as USS file tags. Pure DBCS-only pages (300, 834, 835, 837) are excluded because they require SO/SI byte handling and are unlikely to appear as file-level CCSID tags in practice. The set can be extended in a follow-up if needed.