artbycrunk / vscode-maya

A Visual Studio Code extension with support for coding for Maya.
MIT License
43 stars 9 forks source link

If the script exists Chinese, when sent to maya will be garbled, how to fix it? #6

Closed lingyicheng closed 2 years ago

lingyicheng commented 4 years ago

code like here: print '这是中文'

send python code to maya:

MayaCode [09:47:06][INFO]    Already active : Port 7001 on Host localhost for python
MayaCode [09:47:06][INFO]    Sending selected python code to maya
MayaCode [09:47:06][INFO]    Writing text to C:/Users/lingy/AppData/Local/Temp/MayaCode.py...
MayaCode [09:47:06][INFO]    Executing python("execfile('C:/Users/lingy/AppData/Local/Temp/MayaCode.py')")...
MayaCode [09:47:06][INFO]    python("execfile('C:/Users/lingy/AppData/Local/Temp/MayaCode.py')")
MayaCode [09:47:06][INFO]    Sent python code to Maya...
MayaCode [09:47:06][RESPONSE]    
MayaCode [09:47:06][RESPONSE]    杩欐槸涓枃
lingyicheng commented 4 years ago

I am excited to find a solution, I can solve this problem by adding u in front of the Chinese string. code like here: print u'这是中文'

send python code to maya:

MayaCode [06:37:10][INFO]    Sent python code to Maya...
MayaCode [06:37:10][RESPONSE]    
MayaCode [06:37:47][INFO]    Already active : Port 7001 on Host localhost for python
MayaCode [06:37:47][INFO]    Sending selected python code to maya
MayaCode [06:37:47][INFO]    Writing text to C:/Users/lingy/AppData/Local/Temp/MayaCode.py...
MayaCode [06:37:47][INFO]    Executing python("execfile('C:/Users/lingy/AppData/Local/Temp/MayaCode.py')")...
MayaCode [06:37:47][INFO]    python("execfile('C:/Users/lingy/AppData/Local/Temp/MayaCode.py')")
MayaCode [06:37:47][INFO]    Sent python code to Maya...
MayaCode [06:37:47][RESPONSE]    
MayaCode [06:37:47][RESPONSE]    中文

OK!perfect!

artbycrunk commented 4 years ago

hi @lingyicheng, do you still have this issue? or does that unicode fix work for you?

lingyicheng commented 4 years ago

hi @artbycrunk,Thank you very much for providing this plugin.,there is no have this issue now,but I have to add ’u‘ before each unicode,perfect if you can do that unicode fix work.

artbycrunk commented 2 years ago

Closing this issue as there has been no activity in a long time, feel free to re-open the issue if required.