go-guerrilla
go-guerrilla copied to clipboard
trimToLimit does not work with utf-8 encoding
Hi,
trimToLimit function (in file p_guerrilla_db_redis.go) does not work with utf-8 encoding. This function is also used in the file p_sql.go.
It should be like this to correct operation.
func trimToLimit(str string, limit int) string {
ret := strings.TrimSpace(str)
if len([]rune(str)) > limit {
ret = string([]rune(str)[:limit])
}
return ret
}
Thanks.
Thanks!