Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError #142

Open
i0xHeX opened this issue Apr 18, 2018 · 14 comments
Open

UnicodeEncodeError #142

i0xHeX opened this issue Apr 18, 2018 · 14 comments

Comments

@i0xHeX
Copy link

i0xHeX commented Apr 18, 2018

Downloaded stage after latest commit, without my fixes of unicode later. So one more sample:

Nonstandard attribute b'StackMap' 438
Nonstandard attribute b'StackMap' 14
Nonstandard attribute b'StackMap' 40
Nonstandard attribute b'StackMap' 624
Nonstandard attribute b'StackMap' 28
Nonstandard attribute b'StackMap' 34
Nonstandard attribute b'StackMap' 214
Nonstandard attribute b'StackMap' 411
Nonstandard attribute b'StackMap' 15
Nonstandard attribute b'StackMap' 18
Traceback (most recent call last):
  File "..\disassemble.py", line 73, in <module>
    disassembleSub(readFunc, out, targets, roundtrip=args.roundtrip)
  File "..\disassemble.py", line 46, in disassembleSub
    filename = out.write(name, output.getvalue())
  File "C:\Users\LuckyZeeRo\Desktop\Krakatau\Krakatau\script_util.py", line 152, in write
    f.write(data)
  File "C:\Users\LuckyZeeRo\AppData\Local\Programs\Python\Python37\lib\encodings\cp1251.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u27e8' in position 968: character maps to <undefined>
Press any key to continue . . .

As I understand, my os using cp1251 encoding, and Krakatau can't handle it.
I can give you jar but give me link to pm you.

@Storyyeller
Copy link
Owner

Could you send the link to [email protected]?

@i0xHeX
Copy link
Author

i0xHeX commented Apr 18, 2018

Works okay when applying that to script_util:
https://i.imgur.com/YdQk6gW.png
Yeah, one minute (Sent)

@Storyyeller
Copy link
Owner

The app you sent me disassembles fine on my system, although that's not surprising, since this appears to be a system specific unicode issue. I'll have to trust that your patch works without testing it.

@i0xHeX
Copy link
Author

i0xHeX commented Aug 1, 2018

Again, tried latest release from here, issue still here and unicode only fix above still works. Am I forced to fix this for myself every time u will update Krakatau?
https://privatebin.net/?87c46deacd2e3679#DRIiq9cFURjTWPRbnUyVtwivRlArtEw20MlUj/Vkovc=

Windows 10
Python 3.7.0a2
Zip contains file I tried to disassemble and working script_util.
krakatau.zip

Or if I can change python default encoding to utf 8, how to change it?

@Storyyeller
Copy link
Owner

I do have an old Windows computer, so I'll test it on that and see if I can reproduce the issue.

@Storyyeller
Copy link
Owner

Sorry I forgot about this. I'll try to get to it over the weekend.

@i0xHeX
Copy link
Author

i0xHeX commented Aug 10, 2018

Opened pull request in case you will succesfully reproduce that issue.

@Storyyeller
Copy link
Owner

Sorry, it will take more time than I expected. But I'll try to get to it as soon as I can.

@Storyyeller
Copy link
Owner

I haven't been able to reproduce the issue, so I'm just going to have to trust that your PR is correct. Did you make sure to test it on Python 2 as well?

@i0xHeX
Copy link
Author

i0xHeX commented Aug 14, 2018

Hmm, works well on python 2.7.15.
Seems it's only Python 3.7 issue.

@Owyn
Copy link

Owyn commented Nov 2, 2023

Year 2023 (almost 2024), the bug is still there so I'm unable to use Krakatau (through bytecode-viewer ) with the latest python,

are you gonna stay on python 2.7 forever and make everyone use it?

what's with the rust version? is it out yet? can I put it into bytecode-viewer app somehow instead of the python 2.7 one?

@Janmm14
Copy link

Janmm14 commented Nov 2, 2023

rust version only has (dis)assembly so far.

@Storyyeller
Copy link
Owner

Sorry for the late response, I was on vacation. Anyway, as Janmm14 mentioned, the Rust version only supports the assembler and disassembler, but so does Python 3. The decompiler is 2.7-only. Therefore, if you have any problems with Python 3, that means you are just using the assembler and disassembler, in which case there is no reason not to upgrade to the Rust version.

I strongly recommend switching bytecode-viewer to use the new Rust version, since it is much faster and has more features than the Python version.

@Storyyeller
Copy link
Owner

I filed Konloch/bytecode-viewer#477 to ask bytecode-viewer to upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants