##// END OF EJS Templates
only get the default encoding one time...
Brandon Parsons -
Show More
@@ -29,6 +29,7 b' from subprocess import STDOUT'
29 29 from ._process_common import read_no_interrupt, process_handler, arg_split as py_arg_split
30 30 from . import py3compat
31 31 from . import text
32 from .encoding import getdefaultencoding
32 33
33 34 #-----------------------------------------------------------------------------
34 35 # Function definitions
@@ -94,7 +95,7 b' def _find_cmd(cmd):'
94 95
95 96 def _system_body(p):
96 97 """Callback for _system."""
97 enc = py3compat.getdefaultencoding()
98 enc = getdefaultencoding()
98 99 for line in read_no_interrupt(p.stdout).splitlines():
99 100 line = line.decode(enc, 'replace')
100 101 print(line, file=sys.stdout)
@@ -6,7 +6,9 b' import sys'
6 6 import re
7 7 import types
8 8
9 from IPython.utils.encoding import getdefaultencoding
9 from .encoding import getdefaultencoding
10
11 default_encoding = getdefaultencoding()
10 12
11 13 orig_open = open
12 14
@@ -14,11 +16,11 b' def no_code(x, encoding=None):'
14 16 return x
15 17
16 18 def decode(s, encoding=None):
17 encoding = encoding or getdefaultencoding()
19 encoding = encoding or default_encoding
18 20 return s.decode(encoding, "replace")
19 21
20 22 def encode(u, encoding=None):
21 encoding = encoding or getdefaultencoding()
23 encoding = encoding or default_encoding
22 24 return u.encode(encoding, "replace")
23 25
24 26
General Comments 0
You need to be logged in to leave comments. Login now