Skip to content

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

@ianlopshire

Description

@ianlopshire

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions