Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client can work with different charsets #48

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

bunkenburg
Copy link
Contributor

@bunkenburg bunkenburg commented Apr 9, 2023

AbstractConnectionClient maintains current charset, initialised to US_ASCII.

There are getter and setter for charset.

Method void send(String) uses current charset to convert String to bytes.

The method does not add the corresponding CODEPAGE command. The user must still do that.

@@ -43,6 +47,8 @@ public abstract class AbstractConnectionClient implements TSPLConnectionClient {
protected boolean isConnected = Boolean.FALSE;
protected boolean alive = Boolean.FALSE;

private Charset charset = US_ASCII;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Current charset, initialised to old fixed value.

@@ -176,4 +182,15 @@ protected void notifyDisconnected() {
clientListener.connectionLost(AbstractConnectionClient.this)
));
}

public void send(String message){send(message.getBytes(charset));}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uses current charset.

Assertions.assertEquals(US_ASCII, client.getCharset());
client.setCharset(UTF_8);
Assertions.assertEquals(UTF_8, client.getCharset());
client.send("ë");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This character does not work in US_ASCII, so the test uses UTF-8.

@bunkenburg
Copy link
Contributor Author

"Some checks haven’t completed yet": "Build & Test Expected — Waiting for status to be reported" --- I don't know what to do with that. In the meantime, I cloned it at https://github.com/bunkenburg/tspl2-driver so that I can move forward.

@koneru9999
Copy link
Member

"Some checks haven’t completed yet": "Build & Test Expected — Waiting for status to be reported" --- I don't know what to do with that. In the meantime, I cloned it at https://github.com/bunkenburg/tspl2-driver so that I can move forward.

It seems that the checks hasn't been triggered when the PR is opened. I pushed a ghost commit to your branch that did the trick. I will merge this.

@koneru9999 koneru9999 merged commit 4505905 into fintrace:master Apr 10, 2024
3 checks passed
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.

3 participants