-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
49 lines (37 loc) · 1.17 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package mbcs
import (
"errors"
"golang.org/x/text/transform"
)
// THREAD_ACP is the constant meaning the active codepage for thread
const THREAD_ACP = 3
// ACP is the constant meaning the active codepage for OS
const ACP = 0
// ErrUnsupportedOs is return value when AtoU,UtoA is called on not Windows
var ErrUnsupportedOs = errors.New("Unsupported OS")
// Deprecated: use AnsiToUtf8
func AtoU(ansi []byte, codepage uintptr) (string, error) {
return ansiToUtf8(ansi, codepage)
}
// AnsiToUtf8 Converts Ansi-bytes to UTF8-String
func AnsiToUtf8(ansi []byte, codepage uintptr) (utf8 string, err error) {
return ansiToUtf8(ansi, codepage)
}
// Deprecated: use Utf8ToAnsi
func UtoA(utf8 string, codepage uintptr) (ansi []byte, err error) {
return utf8ToAnsi(utf8, codepage)
}
// Utf8ToAnsi Converts UTF8-String to Ansi-bytes
func Utf8ToAnsi(utf8 string, codepage uintptr) (ansi []byte, err error) {
return utf8ToAnsi(utf8, codepage)
}
// ConsoleCP returns Codepage number of Console.
func ConsoleCP() uintptr {
return consoleCP()
}
func NewEncoder(cp uintptr) transform.Transformer {
return newEncoder(cp)
}
func NewDecoder(cp uintptr) transform.Transformer {
return newDecoder(cp)
}