Add codePointToGlyph to convert codepoint into string
This commit is contained in:
parent
5e6f0abfd6
commit
fd442a3a2b
13
utils.go
13
utils.go
|
@ -2,9 +2,11 @@ package main // import "eriol.xyz/piken"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
|
@ -84,3 +86,14 @@ func readCsvFile(filepath string) (records [][]string, err error) {
|
||||||
return records, nil
|
return records, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert an unicode codepoint into a string.
|
||||||
|
func codePointToGlyph(codepoint string) (string, error) {
|
||||||
|
|
||||||
|
s, err := strconv.ParseInt(codepoint, 16, 32)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%c", s), nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue