File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import GrammarUtils from "../grammar-utils"
44
5+ // https://github.com/atom-community/atom-script/issues/214#issuecomment-418766763
6+ let encodingSet = false
7+ function setEncoding ( ) {
8+ if ( ! encodingSet ) {
9+ process . env . PYTHONIOENCODING = "utf-8"
10+ encodingSet = true
11+ }
12+ }
13+
514export const Python = {
615 "Selection Based" : {
716 command : "python" ,
817 args ( context ) {
18+ setEncoding ( )
919 const code = context . getCode ( )
1020 const tmpFile = GrammarUtils . createTempFileWithCode ( code )
1121 return [ "-u" , tmpFile ]
@@ -15,6 +25,7 @@ export const Python = {
1525 "File Based" : {
1626 command : "python" ,
1727 args ( { filepath } ) {
28+ setEncoding ( )
1829 return [ "-u" , filepath ]
1930 } ,
2031 } ,
@@ -26,6 +37,7 @@ export const Sage = {
2637 "Selection Based" : {
2738 command : "sage" ,
2839 args ( context ) {
40+ setEncoding ( )
2941 const code = context . getCode ( )
3042 const tmpFile = GrammarUtils . createTempFileWithCode ( code )
3143 return [ tmpFile ]
@@ -35,6 +47,7 @@ export const Sage = {
3547 "File Based" : {
3648 command : "sage" ,
3749 args ( { filepath } ) {
50+ setEncoding ( )
3851 return [ filepath ]
3952 } ,
4053 } ,
Original file line number Diff line number Diff line change 1+ print ('汉语/漢語' )
You can’t perform that action at this time.
0 commit comments