baseEmoji

package module
v0.0.0-...-9d7d9d8 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2016 License: MIT Imports: 5 Imported by: 0

README

baseEmoji

Encode things in Emoji because reasons.

You probably shouldn't use this in any kind of serious production environment.

Usage

GoDoc Build Status

    text := "Homura did nothing wrong."
    enc := baseEmoji.DefaultEncoding
    
    // Encode the text string
    encoded, err := enc.Encode([]byte(text))
    if err != nil {
        fmt.Printf("Error encoding: %s\n", err)
        return
    }
    fmt.Printf(file, "%s\n", encoded)
    
    // Write the encoded string to a text file
    encoding.WriteFile("output.txt")
    
    // Decode the dext string
    decoded, err := enc.Decode(encoded.ToBytes())
    if err != nil {
        fmt.Printf("Error decoding: %s\n", err)
        return
    }
    fmt.Printf(file, "%s\n", decoded)

License

See LICENSE.md

Documentation

Overview

Package baseEmoji implements baseEmoji encoding as specified by absolutely nobody.

baseEmoji is similar to base64 only it uses emoji to encode a given set of data instead of the more common a-zA-Z0-9+/= character set.

You probably shouldn't use this in any kind of serious production environment.

Index

Constants

This section is empty.

Variables

View Source
var Utf8Header []byte = []byte{0xEF, 0xBB, 0xBF}

UTF8Header is the UTF-8 byte order mark. This needs to be prepended to text files in order for viewers (browsers, text editors, etc) to display the UTF-8 encoded characters correctly.

Functions

This section is empty.

Types

type Emoji

type Emoji string

Emoji is a single character "rune" encoded as a byte slice

type EmojiString

type EmojiString []Emoji

func (EmojiString) String

func (es EmojiString) String() string

func (*EmojiString) ToBytes

func (es *EmojiString) ToBytes() []byte

ToByte returns the EmojiString as a byte slice. This does not prepend the UTF-8 BOM.

func (*EmojiString) WriteFile

func (es *EmojiString) WriteFile(filename string) error

WriteFile writes the emoji string to the given filename. This prepends the UTF-8 BOM automatically.

type Encoding

type Encoding struct {
	// contains filtered or unexported fields
}
var DefaultEncoding *Encoding

func NewEncode

func NewEncode(emString EmojiString) (*Encoding, error)

NewEncode returns a new Encoding given the EmojiString provided. An error is returned if there are not 65 characters in the EmojiString. The last character is the padding character.

func (*Encoding) Decode

func (enc *Encoding) Decode(input []byte) ([]byte, error)

Decode takes the input byte slice of UTF-8 encoded emoji and decodes it into it's original binary blob as a byte slice.

func (*Encoding) Encode

func (enc *Encoding) Encode(input []byte) (*EmojiString, error)

Encode takes a byte slice and encodes it into an EmojiString encoded in UTF-8 bytes. This does not add the UTF-8 Byte Order Mark (BOM).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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