Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pdu/ucs2.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import (
// ErrUnevenNumber happens when the number of octets (bytes) in the input is uneven.
var ErrUnevenNumber = errors.New("decode ucs2: uneven number of octets")

// ErrIncorrectDataLength happens when the length of octets is less than the header, defined by the first entry of the octets
var ErrIncorrectDataLength = errors.New("decode ucs2: incorrect data length in first entry of octets")

// EncodeUcs2 encodes the given UTF-8 text into UCS2 (UTF-16) encoding and returns the produced octets.
func EncodeUcs2(str string) []byte {
buf := utf16.Encode([]rune(str))
Expand Down