From 4b12dad9371d1ac92ee03837c7e34cdcc247b3f4 Mon Sep 17 00:00:00 2001 From: "chen.s.g" Date: Thu, 31 Jan 2019 11:18:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E5=B0=BE=E9=83=A8=E7=9A=84=E7=BB=93=E6=9D=9F=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E4=BB=A5=E5=85=8D=E8=BE=93=E5=87=BA=E6=97=B6=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workbook.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/workbook.go b/workbook.go index 07e7e09..cd16607 100644 --- a/workbook.go +++ b/workbook.go @@ -245,6 +245,10 @@ func (w *WorkBook) parseString(buf io.ReadSeeker, size uint16, from string) (res w.continue_utf16 = 1 } + if i > 1 && 0 == bts[i-1] { + i-- + } + res = string(utf16.Decode(bts[:i])) } else { var n int @@ -255,6 +259,10 @@ func (w *WorkBook) parseString(buf io.ReadSeeker, size uint16, from string) (res err = io.EOF } + if n > 1 && 0 == bts[n-1] { + n-- + } + var bts1 = make([]uint16, n) for k, v := range bts[:n] { bts1[k] = uint16(v)