unigo

package module
v0.0.0-...-f18f22c Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2017 License: BSD-3-Clause, MIT Imports: 5 Imported by: 0

README

unigo - encode unicode characters in slice as string

Utility functions for encoding ASCII unicode code-points (UTF-8/UTF-16) to runes.

Usage

data := []byte(`\u044d\u0442\u043e \u0442\u0435\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435`)
fmt.Println(unigo.EncodeToString(data) // prints: это тест сообщение

or:

fmt.Println(unigo.EncodeToString([]byte(`{"key":"wasn\u0027t"}`))) // prints: {"key":"wasn't"}

Documentation

At the usual place.

Motivation

There was a discussion on go-nuts that seemed to call out for such a utility.

Documentation

Overview

Utility functions for encoding ASCII unicode code-points (UTF-8/UTF-16) to runes.

Examples:

data := []byte(`\u044d\u0442\u043e \u0442\u0435\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435`)
fmt.Println(unigo.EncodeToString(data) // prints: это тест сообщение

or:
fmt.Println(unigo.EncodeToString([]byte(`{"key":"wasn\u0027t"}`))) // prints: {"key":"wasn't"}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(b []byte) []byte

Encode encodes ASCII unicode code-points in a slice to runes.

func EncodeToString

func EncodeToString(b []byte) string

EncodeToString casts the Encode return to a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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