mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2025-08-24 17:20:48 +02:00
Add test cases and start client
This commit is contained in:
parent
dadaeb611b
commit
5618294f10
4 changed files with 162 additions and 12 deletions
|
@ -2,6 +2,7 @@ package protocol
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"unicode/utf16"
|
||||
"unicode/utf8"
|
||||
|
@ -30,3 +31,12 @@ func DecodeUTF16(b []byte) (string, error) {
|
|||
}
|
||||
return string(bret), nil
|
||||
}
|
||||
|
||||
func EncodeUTF16(s string) []byte {
|
||||
ret := new(bytes.Buffer)
|
||||
enc := utf16.Encode([]rune(s))
|
||||
for c := range enc {
|
||||
binary.Write(ret, binary.LittleEndian, enc[c])
|
||||
}
|
||||
return ret.Bytes()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue