Blame 0001-BUG-Decode-string-based-on-byteorder-of-system.patch

39ab8c4
commit 0b5e0aa3924e4e784257f89e8fc47b07ed5690ba
39ab8c4
Author: Aniket Pradhan <aniket17133@iiitd.ac.in>
39ab8c4
Date:   Wed Nov 4 13:53:15 2020 +0530
39ab8c4
39ab8c4
    BUG: Decode string based on byteorder of system
39ab8c4
39ab8c4
diff --git a/src/datrie.pyx b/src/datrie.pyx
39ab8c4
index 0f91a41..4fae913 100644
39ab8c4
--- a/src/datrie.pyx
39ab8c4
+++ b/src/datrie.pyx
39ab8c4
@@ -1120,7 +1120,10 @@ cdef unicode unicode_from_alpha_char(cdatrie.AlphaChar* key, int len=0):
39ab8c4
     if length == 0:
39ab8c4
         length = cdatrie.alpha_char_strlen(key)*sizeof(cdatrie.AlphaChar)
39ab8c4
     cdef char* c_str = <char*> key
39ab8c4
-    return c_str[:length].decode('utf_32_le')
39ab8c4
+    if sys.byteorder == "little":
39ab8c4
+        return c_str[:length].decode('utf_32_le')
39ab8c4
+    else:
39ab8c4
+        return c_str[:length].decode('utf_32_be')
39ab8c4
 
39ab8c4
 
39ab8c4
 def to_ranges(lst):