aws-toolkit-jetbrains icon indicating copy to clipboard operation
aws-toolkit-jetbrains copied to clipboard

UTF-8 characters in console output are garbled codes in PyCharm

Open yongyili opened this issue 4 years ago • 6 comments

Describe the bug According to JetBrains as we discussed in JetBrains Youtrack, AWS Tool Kit for JetBrains should use winp or winpty instead of runnerw.exe.

To reproduce

  1. Install AWS Toolkit Plugin in PyCharm;
  2. Create an "AWS Serverless Application" in PyCharm;
  3. In lambda_handler() print any UTF-8 characters, such as:
print('你好')
  1. Run the "Hello World Function";

Expected behavior Should be "你好" in console.

Screenshots The output "你好“ in console is like below: image

Your Environment

  • OS: Windows 10 Pro 20H2
  • JetBrains product: PyCharm
  • JetBrains product version: 2021.2.1
  • AWS Toolkit version: 1.32-212
  • SAM CLI version:1.31
  • JVM/Python version: Python3.9.7

yongyili avatar Sep 15 '21 16:09 yongyili

Sorry, I do not have access to that YouTrack link

abrooksv avatar Sep 15 '21 17:09 abrooksv

Hi @abrooksv , I have attached a screenshot of the JetBrains staff reply below: image

In Run tool window of PyCharm, I can see the commands AWS Toolkit use is:

C:\Users\{my name}\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\212.5080.64\bin\runnerw.exe "C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" local invoke HelloWorldFunction --template D:\Repos\Mine\PycharmBugDemo\.aws-sam\build\template.yaml --event "C:\Users\{my name}\AppData\Local\Temp\[Local] HelloWorldFunction-event4.json"

It appears to me that the garbled codes are caused by “runnerw.exe”, since if I use the below command in PyCharm terminal, the output is correct:

"C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" local invoke HelloWorldFunction --template D:\Repos\Mine\PycharmBugDemo\.aws-sam\build\template.yaml --event "C:\Users\{my name}\AppData\Local\Temp\[Local] HelloWorldFunction-event4.json"

The only difference between the 2 commands, is the latter did not use "runnerw.exe".

yongyili avatar Sep 16 '21 02:09 yongyili

And they just deprecated the API 😄 https://github.com/JetBrains/intellij-community/commit/81f5e713926bfa42fb4f078f98c735b8ed1a39fd

abrooksv avatar Sep 16 '21 15:09 abrooksv

This should be fixed now in 1.34, please reopen if still seeing issues

abrooksv avatar Oct 18 '21 16:10 abrooksv

Hi @abrooksv , I have upgrade AWS Toolkit to 1.35-212, but this issue still exist as below image shown. image

If I run the same command in PyCharm terminal window, there is no such issue as blow image shown: image

yongyili avatar Nov 21 '21 17:11 yongyili

We removed the wrapper process, but we can take another look.

abrooksv avatar Nov 22 '21 17:11 abrooksv