Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package main
import (
"fmt"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/transform"
"io"
"log"
"os"
)
/**
ShiftJIS を UTF-8 に。
*/
func main() {
currentDir, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
fmt.Println(currentDir)
f, err := os.Open("shiftjis.txt")
defer f.Close()
if err != nil {
log.Fatal(err)
}
io.Copy(os.Stdout, transform.NewReader(f, japanese.ShiftJIS.NewDecoder()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment