d0vgan / nppexec

NppExec (plugin for Notepad++)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

encoding characters error

Qumojo opened this issue · comments

commented

Hi, first, thanks a lot for your hard work creating this fantastic plugin for np++, I love it.

My issue, is that somewhere somehow, the console corrupts the data... I am not a high tech savy and I'm not too sure how to explain the issue, but I've got a picture of what happens in the normal console under windows cmd and what happens under the nppexec one.
image

Running the script under np++ give that UnicodeEncodeError, but strangely if run directly in that same console, prints the star just fine. Obviously in cmd there is no star, but it doesn't get an error and that's my main thing, I don't mind it printing it badly in the console, I just want to avoid the error/break of the script. Thanks a lot for looking into this.

According to "4.6.4. Running Python & wxPython":
https://htmlpreview.github.io/?https://github.com/d0vgan/nppexec/develop/NppExec/doc/NppExec/NppExec_Manual/4.6.4.html
you need env_set PYTHONIOENCODING=utf-8 to instruct Python to output as utf-8.
In such case, npe_console -- o2 i2 will also be useful to instruct NppExec that the output/input is utf-8.
To sum up:

env_set local PYTHONIOENCODING=utf-8
npe_console local -- o2 i2
set local @exit_cmd = exit()
python -i -u "$(FILE_NAME)"
commented

Yes, this worked perfectly! Thank you so much once again!