Skip to content

Fix character encoding problem for non-ASCII/Chinese data (#795) - #1693

Open
sanjaykumarmtt wants to merge 5 commits into
eclipse-vertx:masterfrom
sanjaykumarmtt:fix-db2-encoding-795
Open

Fix character encoding problem for non-ASCII/Chinese data (#795)#1693
sanjaykumarmtt wants to merge 5 commits into
eclipse-vertx:masterfrom
sanjaykumarmtt:fix-db2-encoding-795

Conversation

@sanjaykumarmtt

Copy link
Copy Markdown

### Motivation
Fixes #795

When reading Chinese or other multi byte characters from DB2 they show up as ??? because the driver only checked OS type instead of the server CCSID.

This change fixes the issue:

  • Maps DB2 CCSID numbers to Java Charset in CCSIDConstants.
  • Uses server column CCSID (sda.ccsid_) if present; otherwise, uses connection level encoding (getCcsidMbcEncoding()).

Conformance

  • I have signed the Eclipse Contributor Agreement (ECA).
  • Followed code style and tested with DB2 database.

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sanjaykumarmtt

Could you please add a test?

@sanjaykumarmtt

Copy link
Copy Markdown
Author

@tsegismont thank you for the review I have added the unit test and formatted the code accordingly

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a test, but I was thinking about actually testing a DB2 query rather than a unit test. Is it possible?

@sanjaykumarmtt

Copy link
Copy Markdown
Author

thanks for the feedback @tsegismont yes that makes sense I will add a DB2 query integration test for this and update the PR soon

@sanjaykumarmtt

Copy link
Copy Markdown
Author

hi @tsegismont ​apologies for the delay I have replaced the previous unit test with a DB2 query integration test in DB2QueriesTest as suggested please review it and let me know if any further changes are needed

tsegismont and others added 2 commits September 7, 2026 17:03
@sanjaykumarmtt

Copy link
Copy Markdown
Author

​I have updated the PR with the suggested fix: casting the untyped parameter marker with CAST(? AS VARCHAR(100)) in DB2QueriesTest, and reverted the unrelated changes.
​Could you please approve and trigger the CI workflow when you have a moment?

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. For me the test passes without the code changes. Can you check if it's actually testing what you want?

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.

vertx-db2-client character encoding problem

2 participants