File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ export class ProcessService implements IProcessService {
22
22
23
23
// Always ensure we have unbuffered output.
24
24
spawnOptions . env . PYTHONUNBUFFERED = '1' ;
25
+ if ( ! spawnOptions . env . PYTHONIOENCODING ) {
26
+ spawnOptions . env . PYTHONIOENCODING = 'utf-8' ;
27
+ }
25
28
26
29
const proc = spawn ( file , args , spawnOptions ) ;
27
30
let procExited = false ;
@@ -78,7 +81,9 @@ export class ProcessService implements IProcessService {
78
81
79
82
// Always ensure we have unbuffered output.
80
83
spawnOptions . env . PYTHONUNBUFFERED = '1' ;
81
-
84
+ if ( ! spawnOptions . env . PYTHONIOENCODING ) {
85
+ spawnOptions . env . PYTHONIOENCODING = 'utf-8' ;
86
+ }
82
87
const proc = spawn ( file , args , spawnOptions ) ;
83
88
const deferred = createDeferred < ExecutionResult < string > > ( ) ;
84
89
const disposables : Disposable [ ] = [ ] ;
Original file line number Diff line number Diff line change @@ -32,6 +32,16 @@ suite('ProcessService', () => {
32
32
expect ( result . stderr ) . to . equal ( undefined , 'stderr not undefined' ) ;
33
33
} ) ;
34
34
35
+ test ( 'exec should output print unicode characters' , async ( ) => {
36
+ const procService = new ProcessService ( new BufferDecoder ( ) ) ;
37
+ const printOutput = 'öä' ;
38
+ const result = await procService . exec ( pythonPath , [ '-c' , `print(u"${ printOutput } ")` ] ) ;
39
+
40
+ expect ( result ) . not . to . be . an ( 'undefined' , 'result is undefined' ) ;
41
+ expect ( result . stdout . trim ( ) ) . to . be . equal ( printOutput , 'Invalid output' ) ;
42
+ expect ( result . stderr ) . to . equal ( undefined , 'stderr not undefined' ) ;
43
+ } ) ;
44
+
35
45
test ( 'exec should wait for completion of program with new lines' , async function ( ) {
36
46
// tslint:disable-next-line:no-invalid-this
37
47
this . timeout ( 5000 ) ;
You can’t perform that action at this time.
0 commit comments