Skip to content
Advertisement

How do decode b”x95xc3x8axb0x8dsx86x89x94x82x8axba”?

[Summary]: The data grabbed from the file is

JavaScript

How to decode these bytes into readable Chinese characters please?

======

I extracted some game scripts from an exe file. The file is packed with Enigma Virtual Box and I unpacked it.

Then I’m able to see the scripts’ names just right, in English, as it supposed to be.

In analyzing these scripts, I get an error looks like this:

JavaScript

I changed the decoding to GBK, and the error disappeared.

But the output file is not readable. It includes readable English characters and non-readable content which supposed to be in Chinese. Example:

chT0002>pDIӘIʆ

I tried different encodings for saving the file and they show the same result, so the problem might be on the decoding part.

The data grabbed from the file is

JavaScript

I tried many ways but I just can’t decode these bytes into readable Chinese characters. Is there anything wrong with the file itself? Or somewhere else? I really need help, please.

One of the scripts are attached here.

Advertisement

Answer

In order to reliably decode bytes, you must know how the bytes were encoded. I will borrow the quote from the python codecs docs:

Without external information it’s impossible to reliably determine which encoding was used for encoding a string.

Without this information, there are ways to try and detect the encoding (chardet seems to be the most widely-used). Here’s how you could approach that.

JavaScript

The above example, however, does not work in this case because chardet isn’t able to detect the encoding of these bytes. At that point, you’ll have to either use trial-and-error or try other libraries.

One method you could use is to simply try every standard encoding, print out the result, and see which encoding makes sense.

JavaScript

Output

JavaScript

Edit: After running all of the seemingly legible results through Google Translate, I suspect this encoding is UTF-16 big-endian. Here’s the results:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement