utfconv

package module
v0.0.0-...-0a7a6cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2012 License: MIT Imports: 3 Imported by: 0

README

utfconv

utfconv is the fast way to convert []byte to string by chooing charset

Installation

Make sure you have the a working Go environment. See the install instructions.

To install utfcon.go, simply run:

go get github.com/xsoameix/utfconv

To compile it from source:

git clone git@github.com:xsoameix/utfconv.git
cd utfconv && go build

Example

package main

import (
    "github.com/xsoameix/utfconv"
)

func main() {
    utf8 := []byte("Hello, world")
    utf16be := []byte("\x00\x48\x00\x65\x00\x6C" +
        "\x00\x6C\x00\x6F\x00\x2C\x00\x20"+
        "\x00\x77\x00\x6F\x00\x72\x00\x6C"+
        "\x00\x64")
    fmt.Printf("%s\n%s\n",
        utfconv.Read("utf8", utf8),
        utfconv.Read("utf16be", utf16be))
}

To run the application, put the code in a file called hello.go and run:

go build hello.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(charset string, data []byte) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL