|
@@ -14,6 +14,7 @@ import (
|
14
|
14
|
"strconv"
|
15
|
15
|
"strings"
|
16
|
16
|
|
|
17
|
+ "golang.org/x/text/encoding/simplifiedchinese"
|
17
|
18
|
"syscall"
|
18
|
19
|
"time"
|
19
|
20
|
"unsafe"
|
|
@@ -1711,7 +1712,7 @@ func ReadCardGetCode(request string) (string, string) {
|
1711
|
1712
|
ret4, _, _ := readCards.Call(StrPtr(str), (uintptr)(unsafe.Pointer(&str3[0])))
|
1712
|
1713
|
fmt.Println(":", string(str3))
|
1713
|
1714
|
|
1714
|
|
-
|
|
1715
|
+ fmt.Println(":", ConvertByte2String(str3, GB18030))
|
1715
|
1716
|
|
1716
|
1717
|
if ret4 == 0 {
|
1717
|
1718
|
result := string(str3)
|
|
@@ -2715,24 +2716,25 @@ func (c *SZHisApiController) GetUpdateMedicalList() {
|
2715
|
2716
|
|
2716
|
2717
|
|
2717
|
2718
|
|
2718
|
|
-
|
|
2719
|
+type Charset string
|
2719
|
2720
|
|
2720
|
|
-
|
2721
|
|
-
|
2722
|
|
-
|
2723
|
|
-
|
2724
|
|
-
|
2725
|
|
-
|
2726
|
|
-
|
2727
|
|
-
|
2728
|
|
-
|
2729
|
|
-
|
2730
|
|
-
|
2731
|
|
-
|
2732
|
|
-
|
2733
|
|
-
|
2734
|
|
-
|
2735
|
|
-
|
2736
|
|
-
|
2737
|
|
-
|
2738
|
|
-
|
|
2721
|
+const (
|
|
2722
|
+ UTF8 = Charset("UTF-8")
|
|
2723
|
+ GB18030 = Charset("GB18030")
|
|
2724
|
+)
|
|
2725
|
+
|
|
2726
|
+func ConvertByte2String(byte []byte, charset Charset) string {
|
|
2727
|
+
|
|
2728
|
+ var str string
|
|
2729
|
+ switch charset {
|
|
2730
|
+ case GB18030:
|
|
2731
|
+ decodeBytes, _ := simplifiedchinese.GB18030.NewDecoder().Bytes(byte)
|
|
2732
|
+ str = string(decodeBytes)
|
|
2733
|
+ case UTF8:
|
|
2734
|
+ fallthrough
|
|
2735
|
+ default:
|
|
2736
|
+ str = string(byte)
|
|
2737
|
+ }
|
|
2738
|
+
|
|
2739
|
+ return str
|
|
2740
|
+}
|