Skip to content
Binary to Emoji πŸ€Ήβ€β™€οΈ
Go
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/base256
.gitignore
.travis.yml
LICENSE
README.md
base256.go
decode.go
decode_test.go
encode.go
encode_test.go
example_test.go
table.go

README.md

base256

Travis Coverage Status Release Go Report Card License GoDoc

πŸŒ€ Base256 is a binary-to-emoji encoding scheme implementation.

Install

$ go get -u ekyu.moe/base256
# or better
$ dep ensure -add ekyu.moe/base256

Example

package main

import (
    "fmt"

    "ekyu.moe/base256"
)

func main() {
    fmt.Println(base256.EncodeToString([]byte("Hello, δΈ–η•Œ")))   //=> πŸ‘ΎπŸ§πŸ™†πŸ¬πŸ™‡πŸŒ±πŸ˜ŒπŸšŸπŸ’¦πŸ₯πŸ΄πŸ€πŸ‘ˆ
    fmt.Println(string(base256.DecodeString("πŸ‘ΎπŸ§πŸ™†πŸ¬πŸ™‡πŸŒ±πŸ˜ŒπŸšŸπŸ’¦πŸ₯πŸ΄πŸ€πŸ‘ˆ"))) //=> Hello, δΈ–η•Œ
}

Check godoc for further documents.

A CLI utility is also available with go get ekyu.moe/base256/cmd/base256.

Specification

base256 encoding uses two tables to transform a single byte into a single emoji. The tables can be found in table.go. In this implementation, these tables are utilized circularly when encoding, however such rule does not apply to decoding.

To achieve the best compatibility, all the emojis are picked from the classic version and each of them is guaranteed to be 4 bytes long in UTF-8.

License

BSD-3-clause

You can’t perform that action at this time.