1
0
mirror of https://github.com/fumiama/go-base16384.git synced 2026-06-05 00:32:52 +08:00
This commit is contained in:
fumiama
2021-08-08 11:19:04 +08:00
parent c4a5495cbd
commit da16be98e0
3 changed files with 13 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ Turn the result to its original coding form to decode.
# Usage
## As package
Just include it in your project.
Just import it in your project.
## As lib
Copy this repo to `$GOPATH/src`, then execute
```bash

View File

@@ -6,10 +6,12 @@ import (
var format = unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM)
// UTF16be2utf8 to display the result as string
func UTF16be2utf8(b []byte) ([]byte, error) {
return format.NewDecoder().Bytes(b)
}
// UTF82utf16be to decode from string
func UTF82utf16be(b []byte) ([]byte, error) {
return format.NewEncoder().Bytes(b)
}

10
mem.go Normal file
View File

@@ -0,0 +1,10 @@
package base14
// #include <stdlib.h>
import "C"
import "unsafe"
// Free memory allocated by encode / decode
func Free(b []byte) {
C.free(unsafe.Pointer(&b[0]))
}