8000 x/text/encoding/traditionalchinese: wrong coding mapping · Issue #21910 · golang/go · GitHub
[go: up one dir, main page]

Skip to content
x/text/encoding/traditionalchinese: wrong coding mapping #21910
Closed
@beikege

Description

@beikege

What version of Go are you using (go version)?

1.9
go get -u golang.org/x/text/

What did you do?

package main

import (
	"fmt"
	"log"
	"unicode/utf8"

	"golang.org/x/text/encoding/traditionalchinese"
)

func main() {
	str := "包"
	b, err := traditionalchinese.Big5.NewEncoder().Bytes([]byte(str))
	if err != nil {
		log.Fatalln(err)
	}
	r, _ := utf8.DecodeRuneInString(str)
	fmt.Printf("unicode:0x%X big5:0x%X\n", r, b) //incorrect
}

What did you expect to see?

unicode:0x5305 big5:0xA55D

What did you see instead?

unicode:0x5305 big5:0xFABD

reference:
http://moztw.org/docs/big5/table/cp950-u2b.txt
http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT
https://encoding.spec.whatwg.org/index-big5.txt

@mpvl

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0