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

ByteSequence should offer methods with an encoding argument #342

Closed
vorburger opened this issue Jul 23, 2018 · 5 comments
Closed

ByteSequence should offer methods with an encoding argument #342

vorburger opened this issue Jul 23, 2018 · 5 comments

Comments

@vorburger
Copy link
Member

com.coreos.jetcd.data.ByteSequence uses java.lang.String's getBytes() which is using the platform's default charset.

ByteSequence's toString() method already has a java.nio.charset.Charset argument, but e.g. its fromString() and several other methods do not.

Ideally, all ByteSequence's methods (static and constructors) should have variant which also accept an java.nio.charset.Charset argument?

@lburgazzoli
Copy link
Collaborator

yes that need to be done, do you mind opening a pr ?

@vorburger
Copy link
Member Author

@lburgazzoli there's more to be done here IMHO... I'll open a 2nd PR following up on your 1st one.

@vorburger vorburger reopened this Aug 20, 2018
vorburger added a commit to vorburger/jetcd that referenced this issue Aug 20, 2018
@vorburger
Copy link
Member Author

FTR - more discussion about this now in #364 ...

vorburger added a commit that referenced this issue Aug 23, 2018
vorburger added a commit to vorburger/jetcd that referenced this issue Aug 23, 2018
and deal with impacts in tests and OSGi ClientService (now with
additional CharSet configuration) and in simple-ctl and watch-example,
defaulting to UTF-8 everywhere.

Fixes etcd-io#342 (again)
@vorburger
Copy link
Member Author

While doing #364, it occured to me that it's "not symetrical" to have toStringUtf8() vs ByteSequence from(String source, Charset charset) methods in ByteSequence - do you know what I mean? For clarity and to "force" explicit usage, in symmetry, personally I would probably suggest to just remove that toStringUtf8() method... would that be OK with you @lburgazzoli et al?

@lburgazzoli
Copy link
Collaborator

ok

vorburger added a commit to vorburger/jetcd that referenced this issue Aug 23, 2018
and deal with impacts in tests and OSGi ClientService (now with
additional CharSet configuration) and in simple-ctl and watch-example,
defaulting to UTF-8 everywhere.

Fixes etcd-io#342 (again)
lburgazzoli pushed a commit that referenced this issue Aug 25, 2018
includes JavaDoc with explanations.

Fixes #342 (again)
lburgazzoli pushed a commit that referenced this issue Aug 25, 2018
and deal with impacts in tests and OSGi ClientService (now with
additional CharSet configuration) and in simple-ctl and watch-example,
defaulting to UTF-8 everywhere.

Fixes #342 (again)
vorburger added a commit to vorburger/jetcd that referenced this issue Aug 27, 2018
better to use explicit toString(Charset charset) instead

fixes etcd-io#342
vorburger added a commit to vorburger/jetcd that referenced this issue Aug 27, 2018
faster & better to use explicit toString(Charset charset) instead

fixes etcd-io#342
vorburger added a commit to vorburger/jetcd that referenced this issue Aug 27, 2018
faster & better to use explicit toString(Charset charset) instead

fixes etcd-io#342
vorburger added a commit to vorburger/jetcd that referenced this issue Aug 27, 2018
better to use explicit toString(Charset charset) instead

fixes etcd-io#342
vorburger added a commit to vorburger/jetcd that referenced this issue Aug 27, 2018
faster & better to use explicit toString(Charset charset) instead

fixes etcd-io#342
lburgazzoli pushed a commit that referenced this issue Aug 27, 2018
better to use explicit toString(Charset charset) instead

fixes #342
lburgazzoli pushed a commit that referenced this issue Aug 27, 2018
faster & better to use explicit toString(Charset charset) instead

fixes #342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants