我以为我会在这里补充的方式剥离的字节顺序标记从序列串-而不是直接字节乱搞(如上图所示)。package mainimport ( "fmt" "strings")func main() { s := "\uFEFF is a string that starts with a Byte Order Mark" fmt.Printf("before: '%v' (len=%v)\n", s, len(s)) ByteOrderMarkAsString := string('\uFEFF') if strings.HasPrefix(s, ByteOrderMarkAsString) { fmt.Printf("Found leading Byte Order Mark sequence!\n") s = strings.TrimPrefix(s, ByteOrderMarkAsString) } fmt.Printf("after: '%v' (len=%v)\n", s, len(s)) }其他“字符串”函数也应该工作。这是打印出来的:before: ' is a string that starts with a Byte Order Mark (len=50)'Found leading Byte Order Mark sequence!after: ' is a string that starts with a Byte Order Mark (len=47)'干杯!