Golang UTF-8 coding Name Attribute #5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Golang string base on an econdage ASCII. So the string don't accept the "accent" like 'éêâîûôàè'.
To resolve this problem we need to encode our name in UTF-8 through Rune in golang. The officiel documentation of Rune in golang.
Code generateName:
Result:
Without the for loop:
Result:
On Consul we don't have any problems. It works perfectly.
Error from:
The error is from our
alphabet[]
, it takes only 1 byte butéèàî
is encoding on several bytes. After we transform this byte in type String.We can't remove the slice and transform this in Map with
int
in key andstring
in value. After we concat the two strings. Like this we don't have any problems.