ThirdParty/CharDet/chardet/jpcntx.py

changeset 5310
f2b774d78b4a
parent 3537
7662053c3906
child 5714
90c57b50600f
diff -r 79b6a38edfc7 -r f2b774d78b4a ThirdParty/CharDet/chardet/jpcntx.py
--- a/ThirdParty/CharDet/chardet/jpcntx.py	Thu Nov 10 18:54:02 2016 +0100
+++ b/ThirdParty/CharDet/chardet/jpcntx.py	Thu Nov 10 18:57:50 2016 +0100
@@ -177,6 +177,12 @@
         return -1, 1
 
 class SJISContextAnalysis(JapaneseContextAnalysis):
+    def __init__(self):
+        self.charset_name = "SHIFT_JIS"
+
+    def get_charset_name(self):
+        return self.charset_name
+
     def get_order(self, aBuf):
         if not aBuf:
             return -1, 1
@@ -184,6 +190,8 @@
         first_char = wrap_ord(aBuf[0])
         if ((0x81 <= first_char <= 0x9F) or (0xE0 <= first_char <= 0xFC)):
             charLen = 2
+            if (first_char == 0x87) or (0xFA <= first_char <= 0xFC):
+                self.charset_name = "CP932"
         else:
             charLen = 1
 

eric ide

mercurial