Unicode support in windows build environment

閲覧: 247 回
最初の未読メッセージにスキップ

Nishant

未読、
2010/09/16 1:03:252010/09/16
To: golang-nuts
I am getting error while using Unicode go source file. After I change
the encoding of ANSI it is working fine.
I have checked with Express Go and it have no issue with Unicode.
There error I am getting with Unicode is

invalid identifier character 0xfeff

Nishant

andrey mirtchovski

未読、
2010/09/16 1:10:552010/09/16
To: golang-nuts
http://msdn.microsoft.com/en-us/library/dd374101(VS.85).aspx

"Since the sequence U+FEFF is exceedingly rare at the beginning of a
regular non-Unicode text file, it can serve as an implicit marker or
signature to identify the file as a Unicode file. Applications that
read both Unicode and non-Unicode text files should use the presence
of this sequence as an indicator that the file is most likely a
Unicode file. Compare this technique to using the MS-DOS EOF marker to
terminate text files."

you may want to try a different editor?

just for test, i tried writing the 0xfeff char to the beginning of an
otherwise valid go program and got the following error:

t.go:1: invalid identifier character 0xfeff
t.go:1: package statement must be first

is that what you're seeing?

Rob 'Commander' Pike

未読、
2010/09/16 1:29:002010/09/16
To: andrey mirtchovski、golang-nuts
U+FEFF is a byte-order mark. It's not meaningful in UTF-8-encoded
files. Your editor is misbehaving.

-rob

Nishant

未読、
2010/09/16 1:26:382010/09/16
To: golang-nuts
I have tried Notepad++ and windows notepad.

UTF 8 =>

$ 8g hello.go
hello.go:1: invalid identifier character 0xfeff
hello.go:1: package statement must be first
hello.go:1: non-declaration statement outside function body
hello.go:1: syntax error: unexpected name, expecting semicolon or
newline

Unicode (in notepad)=>

$ 8g hello.go
hello.go:1: illegal NUL byte
hello.go:1: illegal UTF-8 sequence
ff fe 70 00
hello.go:1: invalid identifier character 0xfffd
hello.go:1: illegal NUL byte
hello.go:1: package statement must be first
hello.go:1: illegal NUL byte
hello.go:1: non-declaration statement outside function body
hello.go:1: syntax error: unexpected name, expecting semicolon or
newline
hello.go:1: illegal NUL byte
hello.go:1: too many errors

Nishant

未読、
2010/09/16 1:55:142010/09/16
To: golang-nuts
Yes my editor was misbehaving. Finally I got UTF-8 encoding working by
using Programmer's Notepad, it is also working with EditPlus.

Thanks
Nishant

fango

未読、
2010/09/16 1:56:042010/09/16
To: golang-nuts

> I am getting error while using Unicode go source file. After I change
> the encoding of ANSI it is working fine.

Don't save as "Unicode", Go source is supposed to be 'UTF-8', though
ANSI is almost a subset.

Cheers,
Fango

Nishant

未読、
2010/09/16 2:03:292010/09/16
To: golang-nuts
I got is working with Notepad ++, supported encoding is "UTF-8 without
BOM"

Thanks
Nishant
全員に返信
投稿者に返信
転送
新着メール 0 件