Commit a9f1569e authored by Volker Dobler's avatar Volker Dobler Committed by Rob Pike

gc: escape unicode BOM in exported string literals

Fixes #5260.

R=golang-dev, minux.ma, 0xjnml, r
CC=golang-dev
https://golang.org/cl/8658043
parent 548c65a5
......@@ -443,6 +443,9 @@ Zconv(Fmt *fp)
fmtrune(fp, '\\');
fmtrune(fp, r);
break;
case 0xFEFF: // BOM, basically disallowed in source code
fmtstrcpy(fp, "\\uFEFF");
break;
}
}
return 0;
......
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package a
const BOM = "\uFEFF"
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "./a"
func main() {
_ = a.BOM
}
// rundir
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 5260: Unicode BOM in exported string constant
// cannot be read back during package import.
package ignored
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment