Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 219 forks source link

UnicodeEncodeError ZKM on disassembling #134

Closed i0xHeX closed 6 years ago

i0xHeX commented 6 years ago

Python 3.7.0a2 Krakatau latest zip from here. Tried to disassemble zkm 9: https://hastebin.com/numaluhemu.sql

It's seems problem with default Windows encoding. I googled. but found nothing useful how to fix this. Also tried to change 151 line script_util.py to with open(out, mode, encoding='utf-8'). Disassembling good but Assembling failing with and without encoding='utf-8'.

Storyyeller commented 6 years ago

Does this happen only on Windows? Also, could you post the file you were trying to disassemble?

i0xHeX commented 6 years ago

I didn't tried on other platforms, but google searching results seems that unix platforms do not have similar issues. Link to file: https://www.dropbox.com/s/8l4ucu1st615ygn/hb.class?dl=0 Other class, disassembled without problems: https://www.dropbox.com/s/0lalgk5byr9l6gy/gl.class?dl=0

i0xHeX commented 6 years ago

Default encoding is utf8:

>>> import sys
>>> sys.getdefaultencoding()
'utf-8'
i0xHeX commented 6 years ago

This fixed my issue: https://hastebin.com/enohupijas.pas

Storyyeller commented 6 years ago

Thanks for investigating this. I'll hopefully get to it over the weekend.

Storyyeller commented 6 years ago

Could you repost the file please? The link isn't working for me.

i0xHeX commented 6 years ago

https://ghostbin.com/paste/urx5r

Storyyeller commented 6 years ago

No, I mean the classfile that caused the error.

i0xHeX commented 6 years ago

https://www.dropbox.com/s/f3lrmwgrjhqoli3/hb%26gl.zip?dl=0 hb.class | with error gl.class | in same situation ok

i0xHeX commented 6 years ago

How are things?

Storyyeller commented 6 years ago

Sorry, I'll try to get to it over the weekend.

Storyyeller commented 6 years ago

I tried disassembling the file you provided on my old Windows machine, but it disassembled without errors.

Edit: I did get an error with Python 3 on Windows disassembling hb.class, but it is different from the one you posted.

Storyyeller commented 6 years ago

Ok, I went ahead and pushed a fix for the issue I noticed. I can't reproduce the original error, so I'll close this for now, but if you find a way to reliably reproduce it, feel free to reply.