##// END OF EJS Templates
Better encoding handling....
Cody Precord -
Show More
@@ -30,6 +30,21 b' import wx.stc as stc'
30 import re
30 import re
31 from StringIO import StringIO
31 from StringIO import StringIO
32
32
33 import sys
34 import codecs
35 import locale
36 for enc in (locale.getpreferredencoding(),
37 sys.getfilesystemencoding(),
38 sys.getdefaultencoding()):
39 try:
40 codecs.lookup(enc)
41 ENCODING = enc
42 break
43 except LookupError:
44 pass
45 else:
46 ENCODING = 'utf-8'
47
33 from ipshell_nonblocking import NonBlockingIPShell
48 from ipshell_nonblocking import NonBlockingIPShell
34
49
35 class WxNonBlockingIPShell(NonBlockingIPShell):
50 class WxNonBlockingIPShell(NonBlockingIPShell):
@@ -604,7 +619,7 b' class IPShellWidget(wx.Panel):'
604 self.text_ctrl.write('\n')
619 self.text_ctrl.write('\n')
605 lines_to_execute = lines.replace('\t',' '*4)
620 lines_to_execute = lines.replace('\t',' '*4)
606 lines_to_execute = lines_to_execute.replace('\r','')
621 lines_to_execute = lines_to_execute.replace('\r','')
607 self.IP.doExecute(lines_to_execute.encode('cp1252'))
622 self.IP.doExecute(lines_to_execute.encode(ENCODING))
608 self.updateHistoryTracker(lines)
623 self.updateHistoryTracker(lines)
609 self.setCurrentState('WAIT_END_OF_EXECUTION')
624 self.setCurrentState('WAIT_END_OF_EXECUTION')
610
625
General Comments 0
You need to be logged in to leave comments. Login now