go-proto-validators
go-proto-validators copied to clipboard
Support for multibyte strings
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.
https://github.com/mwitkow/go-proto-validators/blob/32a686adf8b5194d3ea07d632d49b6fb344af678/plugin/plugin.go#L446
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) {