<分区>
golang(go语言)中如何将字符串文本转为utf8?
<分区>
golang(go语言)中如何将字符串文本转为utf8?
最佳答案
go 中的字符串文字默认使用 UTF-8 编码。 来自official golang blog
Go source code is UTF-8, so the source code for the string literal is UTF-8 text
但这不适用于转义字符,例如 \n
:
If that string literal contains no escape sequences, which a raw string cannot, the constructed string will hold exactly the source text between the quotes.
希望这对您有所帮助!
关于go - 在go中用UTF-8格式编码字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40082833/