Skip to content

Instantly share code, notes, and snippets.

View suzuken's full-sized avatar

Kenta SUZUKI suzuken

View GitHub Profile
@suzuken
suzuken / d.go
Created February 10, 2015 04:51
package main
import (
"bufio"
"fmt"
"github.com/saintfish/chardet"
"io"
"os"
)
@suzuken
suzuken / e.go
Created February 10, 2015 06:26
package main
import (
"bufio"
"fmt"
"golang.org/x/net/html/charset"
"os"
)
// 行単位でcharset.DetermineEncodingつかって判別してみたが、そういう用途ではなかった
@suzuken
suzuken / f.go
Created February 10, 2015 07:37
package main
import (
"fmt"
"golang.org/x/net/html/charset"
"io/ioutil"
)
func main() {
c, err := ioutil.ReadFile("/tmp/testfile")
package main
import (
"fmt"
)
// original: http://blog.golang.org/strings
func main() {
const sample = "\xbd\xb2\x3d\xbc\x20\xe2\x8c\x98"
fmt.Println(sample)
package main
import (
"bytes"
"fmt"
)
func main() {
b1 := []byte{1, 2, 3}
s := bytes.Split(b1, []byte{2})
package main
import (
"fmt"
)
type Hoge struct {
Fuga string
}
package main
import (
"fmt"
"html"
"log"
"net/http"
)
package main
import (
"fmt"
)
func main() {
a := []string{"hoge", "fuga"}
fmt.Printf("%s\n", a)
fmt.Println(a)
// example of embedding
// embedding Job into Command
package main
import (
"fmt"
)
type Job struct {
unknown string
package main
import (
"fmt"
"github.com/djimenez/iconv-go"
)
func main() {
fmt.Println(iconv.ConvertString("あいうえお", "utf-8", "shift_jis"))
fmt.Println(iconv.ConvertString("あいうえお", "utf-8", "euc-jp"))