If you run fmt.Println(\"\\u554a\"), it shows \'啊\'.
fmt.Println(\"\\u554a\")
But how to get unicode-style-string \\u554a from a rune \'啊\' ?
\\u554a
You can use fmt.Sprintf along with %U to get the hexadecimal value:
fmt.Sprintf
%U
test = fmt.Sprintf("%U", '啊') fmt.Println("\\u" + test[2:]) // Print \u554A