Skip to content
New issue

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

x/text/encoding: ShfitJIS doesn't handle cp932 #13727

Closed
mattn opened this issue Dec 24, 2015 · 4 comments
Closed

x/text/encoding: ShfitJIS doesn't handle cp932 #13727

mattn opened this issue Dec 24, 2015 · 4 comments

Comments

@mattn
Copy link
Member

mattn commented Dec 24, 2015

text/encoding/japanese.ShiftJIS explain it can handle cp932 in doc.
https://github.com/golang/text/blob/master/encoding/japanese/shiftjis.go#L17-L18

But below's code doesn't work because the range of lead-byte is range of ShiftJIS not cp932.

package main

import (
    "golang.org/x/text/encoding/japanese"
    "golang.org/x/text/transform"
    "log"
)

func main() {
    // 髙(FBFC)
    s, _, err := transform.String(japanese.ShiftJIS.NewDecoder(), "\xFB\xFC")
    if err != nil {
        log.Fatal(err.Error())
    }
    log.Print(s)
    // 﨑(FAB1)
    s, _, err = transform.String(japanese.ShiftJIS.NewDecoder(), "\xFA\xB1")
    if err != nil {
        log.Fatal(err.Error())
    }
    log.Print(s)
}
@gopherbot
Copy link

CL https://golang.org/cl/18116 mentions this issue.

@ianlancetaylor ianlancetaylor changed the title text/encoding: ShfitJIS doesn't handle cp932 x/text/encoding: ShfitJIS doesn't handle cp932 Dec 24, 2015
@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Dec 24, 2015
@mattn
Copy link
Member Author

mattn commented Jan 8, 2016

I'm thinking this should be contained in 1.6 .

@minux
Copy link
Member

minux commented Jan 8, 2016 via email

@mattn
Copy link
Member Author

mattn commented Jan 8, 2016

@minux ah, fair enough. thank you.

@golang golang locked and limited conversation to collaborators Mar 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants