I want to say:
In fact, ironpython2.7 provides excellent support for Chinese characters.
You can rest assured to use
But remember not to use the str () function.
It cannot be parsed if it contains Chinese characters.
I checked a lot of information.
You have to change the source code.
The above uses SharpDeverlop + Iconpython2.7 for testing.
The window is pulled by the SharpDeverlop ipy designer.
Rough source code
Class MyError (Exception ):
Def _ init _ (self, value ):
Self. value = value
Def _ str _ (self ):
Return repr (self. value)
Class RunAlt ():
Import clr
Clr. AddReference ('ironpython ')
From IronPython. Hosting import Python
Engine = Python. CreateEngine ()
Scope = engine. createlist ()
Print 'Load parser'
# Scope. SetVariable ("my_object_model", CallingPython ())
Def _ init _ (self, str ):
Self. Str = str
Def GetPy (self ):
Return self. Str
Def RunPy (self ):
# Self. engine. Execute ("print ''")
Try:
Source = self. engine. CreateScriptSourceFromString (self. Str)
Source. Execute (self. scope)
Failed t RunAlt. MyError as e:
Print 'my exception, value: ', e. value
RunAlt = RunAlt ("print 'call '")
RunAlt. RunPy ()
From System import Console
Console. Read ()