Permalink
Browse files

Use UTF-8 LC_CTYPE if no locale variables are set

  • Loading branch information...
1 parent cd96c75 commit 892577a6e5c3b60f3583894e1929f80bd274c30b @technocoreai committed Feb 27, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 external_command.py
View
@@ -1,4 +1,4 @@
-import sublime, sublime_plugin, subprocess, thread, re
+import sublime, sublime_plugin, subprocess, thread, re, os
class CancelledException(Exception):
pass
@@ -41,12 +41,17 @@ def run_filter(self, region_text):
if self.cancelled:
raise CancelledException()
+ env = dict(os.environ)
+ if not ('LC_CTYPE' in env or 'LC_ALL' in env or 'LANG' in env):
+ env['LC_CTYPE'] = 'en_US.UTF-8'
+
self.proc = subprocess.Popen(
self.cmdline,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- shell=True)
+ shell=True,
+ env=env)
stdout, stderr = self.proc.communicate(region_text)
returncode = self.proc.returncode

0 comments on commit 892577a

Please sign in to comment.