We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I try to decode a GB2312, got a panic error. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x0 pc=0x697f2] goroutine 1 [running]: runtime.panic(0x20b320, 0x570cd9) /Users/Hong/go/src/pkg/runtime/panic.c:266 +0xb6 code.google.com/p/mahonia.Decoder.ConvertString(0x0, 0xc210045460, 0xda, 0xc210045460, 0xda) /Users/Hong/gocode/src/code.google.com/p/mahonia/convert_string.go:41 +0xd2 main.fetch(0xc21000af80, 0xc21000aef0, 0xc210045460, 0xda) ------------------------ GB2312 (1980) has been superseded by GBK and GB18030 ([2]). So I register the GB2312 charset in gbk.go file. Now It's work fine for me. ~GOPATH/src/code.google.com/p/mahonia hg diff diff -r 420ce60cb671 gbk.go --- a/gbk.go Fri Jul 19 13:15:30 2013 -0700 +++ b/gbk.go Mon Dec 09 22:27:42 2013 +0800 @@ -12,6 +12,15 @@ return encodeGBKRune }, }) + RegisterCharset(&Charset{ + Name: "GB2312", + NewDecoder: func() Decoder { + return decodeGBKRune + }, + NewEncoder: func() Encoder { + return encodeGBKRune + }, + }) } func decodeGBKRune(p []byte) (r rune, size int, status Status) { ---------- [1]: http://en.wikipedia.org/wiki/GBK [2]: http://en.wikipedia.org/wiki/GB2312
Original issue reported on code.google.com by bord...@gmail.com on 9 Dec 2013 at 2:33
bord...@gmail.com
The text was updated successfully, but these errors were encountered:
I added GB2312 as an alias for GBK, instead of as a separate charset with the same encoding.
Original comment by andybalholm@gmail.com on 11 Dec 2013 at 5:05
andybalholm@gmail.com
Sorry, something went wrong.
No branches or pull requests
Original issue reported on code.google.com by
bord...@gmail.com
on 9 Dec 2013 at 2:33The text was updated successfully, but these errors were encountered: