File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import GrammarUtils from "../grammar-utils"
4
4
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
+
5
14
export const Python = {
6
15
"Selection Based" : {
7
16
command : "python" ,
8
17
args ( context ) {
18
+ setEncoding ( )
9
19
const code = context . getCode ( )
10
20
const tmpFile = GrammarUtils . createTempFileWithCode ( code )
11
21
return [ "-u" , tmpFile ]
@@ -15,6 +25,7 @@ export const Python = {
15
25
"File Based" : {
16
26
command : "python" ,
17
27
args ( { filepath } ) {
28
+ setEncoding ( )
18
29
return [ "-u" , filepath ]
19
30
} ,
20
31
} ,
@@ -26,6 +37,7 @@ export const Sage = {
26
37
"Selection Based" : {
27
38
command : "sage" ,
28
39
args ( context ) {
40
+ setEncoding ( )
29
41
const code = context . getCode ( )
30
42
const tmpFile = GrammarUtils . createTempFileWithCode ( code )
31
43
return [ tmpFile ]
@@ -35,6 +47,7 @@ export const Sage = {
35
47
"File Based" : {
36
48
command : "sage" ,
37
49
args ( { filepath } ) {
50
+ setEncoding ( )
38
51
return [ filepath ]
39
52
} ,
40
53
} ,
Original file line number Diff line number Diff line change
1
+ print ('汉语/漢語' )
You can’t perform that action at this time.
0 commit comments