-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Decoding of compressed characters is not handled correclty:
func (r *LabelBIFF8) GetString() string {
if int(r.grbit[0]) == 1 {
name := helpers.BytesToUints16(r.rgb[:])
runes := utf16.Decode(name)
return string(runes)
} else {
return string(decodeWindows1251(r.rgb[:]))
}
}
The code outputs incorrect result: Hinterfьllmaterial Ш 6 mm
Expected output Hinterfüllmaterial Ø 6 mm
Each compressed character(byte) has to be converted into unit16 and then decoded.
The line return string(decodeWindows1251(r.rgb[:])) should be replaced with:
name := []uint16{}
for _, b := range r.rgb[:] {
name = append(name, uint16(b))
}
runes := utf16.Decode(name)
return string(runes)
Metadata
Metadata
Assignees
Labels
No labels