Skip to content

Fix Firebird SJIS_0208 character set mapping - #40593

Open
dragonknightk wants to merge 1 commit into
apache:masterfrom
dragonknightk:fix/firebird-sjis-0208-charset
Open

dragonknightk wants to merge 1 commit into
apache:masterfrom
dragonknightk:fix/firebird-sjis-0208-charset

Conversation

@dragonknightk

Copy link
Copy Markdown

Fixes #40243.

Changes proposed in this pull request:

  • Map FirebirdCharacterSets.SJIS_0208 to Java Shift_JIS instead of ISO-2022-JP so Firebird Proxy decodes Shift-JIS text on SJIS_0208 connections without turning Japanese characters into U+FFFD replacement characters.
  • Use Shift_JIS instead of Jaybird's MS932 to match the Firebird 5.0.4 server. Firebird defines SJIS_0208 on standard JIS X 0208 Shift-JIS rather than Windows-31J. Mapping to MS932 would accept Windows extensions and remap JIS symbols like 0x8160 to U+FF5E instead of U+301C, which differs from what the Firebird server stores and breaks round-trip transliteration on SJIS_0208 columns. This also matches the other standard IANA mappings in FirebirdCharacterSets, such as KSC_5601 to EUC-KR.
  • Add a unit test verifying that SJIS_0208 resolves to Shift_JIS and decodes Shift-JIS bytes for 日本語 to the expected text.
  • Local verification scope: installed upstream dependencies with -pl proxy/backend/dialect/firebird,proxy/frontend/dialect/firebird -am -DskipTests -DskipITs, then ran unit tests, spotless:check, and checkstyle:check (-Pcheck) for proxy/backend/dialect/firebird and proxy/frontend/dialect/firebird, plus apache-rat:check -Pcheck across the repository.

Before submitting this PR, I confirm that:

  • My code follows the code of conduct of this project.
  • I have reviewed my changes.
  • I have (or in comment I request) added corresponding labels for the pull request. (maintainer to add labels)
  • I have passed the required local checks: ./mvnw clean install -B -T1C -Pcheck.
  • I have updated the relevant documentation, if applicable.
  • I have added or updated unit tests for my changes, if applicable.
  • I have updated the Release Notes of the current development version, if applicable. For more details, see Update Release Note.
  • I have disclosed the tool and affected files or scope for any material AI assistance, as required by the AI-assisted contribution policy.

AI Disclosure

Human-led contribution. Grok Bot, working for dragonknightk, assisted with the code, tests, and description in proxy/backend/dialect/firebird and RELEASE-NOTES.md. All submitted content was reviewed and verified by a human before submission.

Closes issue 40243

Changes proposed in this pull request:
  - Map `FirebirdCharacterSets.SJIS_0208` to Java `Shift_JIS` instead of `ISO-2022-JP` so Firebird Proxy decodes Shift-JIS text on `SJIS_0208` connections without turning Japanese characters into U+FFFD replacement characters.
  - Use `Shift_JIS` instead of Jaybird's `MS932` to match the Firebird 5.0.4 server. Firebird defines `SJIS_0208` on standard JIS X 0208 Shift-JIS rather than Windows-31J. Mapping to `MS932` would accept Windows extensions and remap JIS symbols like `0x8160` to `U+FF5E` instead of `U+301C`, which differs from what the Firebird server stores and breaks round-trip transliteration on `SJIS_0208` columns. This also matches the other standard IANA mappings in `FirebirdCharacterSets`, such as `KSC_5601` to `EUC-KR`.
  - Add a unit test verifying that `SJIS_0208` resolves to `Shift_JIS` and decodes Shift-JIS bytes for `日本語` to the expected text.
  - Local verification scope: installed upstream dependencies with `-pl proxy/backend/dialect/firebird,proxy/frontend/dialect/firebird -am -DskipTests -DskipITs`, then ran unit tests, `spotless:check`, and `checkstyle:check` (`-Pcheck`) for `proxy/backend/dialect/firebird` and `proxy/frontend/dialect/firebird`, plus `apache-rat:check -Pcheck` across the repository.

---

Before submitting this PR, I confirm that:
- [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [x] I have reviewed my changes.
- [ ] I have (or in comment I request) added corresponding labels for the pull request. (maintainer to add labels)
- [x] I have passed the required local checks: `./mvnw clean install -B -T1C -Pcheck`.
- [ ] I have updated the relevant documentation, if applicable.
- [x] I have added or updated unit tests for my changes, if applicable.
- [x] I have updated the Release Notes of the current development version, if applicable. For more details, see [Update Release Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/).
- [ ] I have disclosed the tool and affected files or scope for any material AI assistance, as required by the [AI-assisted contribution policy].

[AI-assisted contribution policy]: https://github.com/apache/shardingsphere/blob/master/AI_POLICY.md

Signed-off-by: DragonKnightK <37928252+dragonknightk@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firebird Proxy decodes text sent on a SJIS_0208 connection as ISO-2022-JP and stores replacement characters instead of it

1 participant