Skip to content

Support for multibyte strings #105

@tomtwinkle

Description

@tomtwinkle

len(string) does not count by characters but by bytes, so if a multibyte string is specified for validation, it cannot be validated by characters.
In order to accurately determine the number of characters, len([]rune(string)) should be used.

p.P(`if !( len(`, variableName, `) < `, fv.LengthLt, `) {`)

v0.3.2 generated

	if !(len(this.Keyword) < 1000) {

I think this is a good way to fix it.

	if !(len([]rune(this.Keyword)) < 1000) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions