If I encode the following string as UTF8:
café
It’s returned as 5 bytes instead of 4. I’d like it to return 4 bytes if possible.
Encoding encoding = Encoding.UTF8;
string testString = "café";
Byte[] bytes = encoding.GetBytes(testString);
Returns:
[0] 99
[1] 97
[2] 102
[3] 195
[4] 169
Whereas “cafe” returns only 4 bytes.
Ended up converting
UTF8toISO8859-1and it’s now returning 4 bytes instead of 5.Outputs:
café
café