Blob Blame History Raw
commit 0b5e0aa3924e4e784257f89e8fc47b07ed5690ba
Author: Aniket Pradhan <aniket17133@iiitd.ac.in>
Date:   Wed Nov 4 13:53:15 2020 +0530

    BUG: Decode string based on byteorder of system

diff --git a/src/datrie.pyx b/src/datrie.pyx
index 0f91a41..4fae913 100644
--- a/src/datrie.pyx
+++ b/src/datrie.pyx
@@ -1120,7 +1120,10 @@ cdef unicode unicode_from_alpha_char(cdatrie.AlphaChar* key, int len=0):
     if length == 0:
         length = cdatrie.alpha_char_strlen(key)*sizeof(cdatrie.AlphaChar)
     cdef char* c_str = <char*> key
-    return c_str[:length].decode('utf_32_le')
+    if sys.byteorder == "little":
+        return c_str[:length].decode('utf_32_le')
+    else:
+        return c_str[:length].decode('utf_32_be')
 
 
 def to_ranges(lst):