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

Use codepoint indices should be opt-out instead of opt-in #53

Open
ianlopshire opened this issue May 8, 2023 · 0 comments
Open

Use codepoint indices should be opt-out instead of opt-in #53

ianlopshire opened this issue May 8, 2023 · 0 comments
Labels

Comments

@ianlopshire
Copy link
Owner

The encoder and decoder currently support multi-byte characters, but it requires library users to enable the feature explicitly. This behavior is unintuitive and leads to confusion (see #52).

decoder := fixedwidth.NewDecoder(strings.NewReader(data))
decoder.SetUseCodepointIndices(true)
// Decode as usual now
buff := new(bytes.Buffer)
encoder := fixedwidth.NewEncoder(buff)
encoder.SetUseCodepointIndices(true)
// Encode as usual now

There is still a performance cost associated with supporting multi-byte characters, so I'd like to keep the feature in the library.

Mutlti-byte character support should be enabled by default, but there should still be an option to opt-out.

This is a breaking change and should be released as part of a major version bump.

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

No branches or pull requests

1 participant