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

trimToLimit does not work with utf-8 encoding #209

Open
4k7 opened this issue May 14, 2020 · 1 comment
Open

trimToLimit does not work with utf-8 encoding #209

4k7 opened this issue May 14, 2020 · 1 comment

Comments

@4k7
Copy link

4k7 commented May 14, 2020

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.

@flashmob
Copy link
Owner

Thanks!

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

2 participants