mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2025-07-21 18:15:54 +02:00
testing dropping '00'
This commit is contained in:
parent
7bfc9e5012
commit
31f09af9d0
1 changed files with 5 additions and 3 deletions
8
rdg.go
8
rdg.go
|
@ -619,8 +619,6 @@ func DecodeUTF16(b []byte) (string, error) {
|
||||||
return "", fmt.Errorf("must have even length byte slice")
|
return "", fmt.Errorf("must have even length byte slice")
|
||||||
}
|
}
|
||||||
|
|
||||||
b, _ = dropCR(b)
|
|
||||||
|
|
||||||
u16s := make([]uint16, 1)
|
u16s := make([]uint16, 1)
|
||||||
ret := &bytes.Buffer{}
|
ret := &bytes.Buffer{}
|
||||||
b8buf := make([]byte, 4)
|
b8buf := make([]byte, 4)
|
||||||
|
@ -633,7 +631,11 @@ func DecodeUTF16(b []byte) (string, error) {
|
||||||
ret.Write(b8buf[:n])
|
ret.Write(b8buf[:n])
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret.String(), nil
|
bret := ret.Bytes()
|
||||||
|
if len(bret) > 0 && bret[len(bret)-1] == '\x00' {
|
||||||
|
bret = bret[:len(bret)-1]
|
||||||
|
}
|
||||||
|
return string(bret), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UTF-16 endian byte order
|
// UTF-16 endian byte order
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue