Skip to content

Golang module to convert texts in Beta Code to UTF-8 and back

License

Notifications You must be signed in to change notification settings

jllovet/betacode-utf8-transcoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Beta Code and UTF-8 Transcoder

Go Reference

This transcoder allows you to convert texts that are in Beta Code to UTF-8 and back. Its primary purpose is to support working with Ancient Greek datasets that used Beta Code as their encoding.

This project owes a great deal to github.com/matgrioni/betacode, which is an analogous transcoder written in python. Portions of this transcoder are translations of that project into Go, and the goals of our projects are very nearly the same. Thanks, Matias!

Installation

go get github.com/jllovet/betacode-utf8-transcoder

Usage

The most frequent uses you'll have for this package are converting text between betacode and utf8 using BetaToUni and UniToBeta.

Example Usage of BetaToUni

// BetaToUni(beta string) (uni string, err error)
package main

import (
    "fmt"
    "log"

    "github.com/jllovet/betacode-utf8-transcoder"
)

func main() {
    b := `a)/lfa`
    u, err := transcoder.BetaToUni(b)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(b, "becomes", u)
}
> go run main.go
> a)/lfa becomes ἄλφα

Example Usage of UniToBeta

// UniToBeta(uni string) (beta string, err error)
package main

import (
    "fmt"
    "log"

    "github.com/jllovet/betacode-utf8-transcoder"
)

func main() {
    u := `ἄλφα`
    b, err := transcoder.UniToBeta(u)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(u, "becomes", b)
}
> go run main.go
> ἄλφα becomes a)/lfa

Resources

If this project helped you with a project of yours, I'd love if you threw a coffee my way to fuel enhancements and similar projects in the future.

"Buy Me A Coffee"

Encodings and Transcording Background and Specs

Unicode Resources Online

Unicode Normalization

Unicode Normalization and Using Unicode in Go

Trie, Trie, Trie Again

Videos
Articles

Other Beta Code to UTF-8 Transcoders

About

Golang module to convert texts in Beta Code to UTF-8 and back

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages