使用UTF-8格式对字符串进行编码[重复]

This question already has an answer here:

How to convert string text to utf8 in golang (go language)?

</div>

The string literals in go are encoded in UTF-8 by default. From the official golang blog

Go source code is UTF-8, so the source code for the string literal is UTF-8 text

However this doesn't apply to the escape characters, such as :

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.

Hope this helps!