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

Support for multibyte strings #105

Open
tomtwinkle opened this issue Mar 23, 2021 · 0 comments
Open

Support for multibyte strings #105

tomtwinkle opened this issue Mar 23, 2021 · 0 comments

Comments

@tomtwinkle
Copy link

tomtwinkle commented Mar 23, 2021

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) {
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

No branches or pull requests

1 participant