Sfoglia il codice sorgente

fix: prioritize Japanese encodings in CSV reading

mrh (aider) 1 anno fa
parent
commit
667e1d9360
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      mylib/read_encoding_cvs.py

+ 2 - 2
mylib/read_encoding_cvs.py

@@ -54,8 +54,8 @@ def read_csv(file_path: str) -> List[List[str]]:
     Returns:
         包含CSV数据的二维列表
     """
-    # 常见编码列表,按优先级排序
-    encodings_to_try = ['utf-8-sig', 'gb18030', 'shift_jis', 'euc-jp', 'iso-8859-1', 'latin1']
+    # 常见编码列表,按优先级排序,优先尝试日文编码
+    encodings_to_try = ['shift_jis', 'euc-jp', 'utf-8-sig', 'gb18030', 'iso-8859-1', 'latin1']
     
     # 先尝试检测编码
     detected_encoding = detect_encoding(file_path)