Support for multibyte strings
tomtwinkle opened this issue · 0 comments
tomtwinkle commented
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.
go-proto-validators/plugin/plugin.go
Line 446 in 32a686a
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) {