Skip to content

Commit

Permalink
Merge pull request #9 from Vasfed/fix_unicode_st3
Browse files Browse the repository at this point in the history
Fix unicode entities for python3
  • Loading branch information
akalongman committed Oct 1, 2015
2 parents aa73216 + 0571e76 commit cc66ba5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions stringutilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
import json
import pprint


if sys.hexversion >= 0x3000000:
def unichr(c):
return chr(c)


class ConvertTabsToSpacesCommand(sublime_plugin.TextCommand):
Expand Down Expand Up @@ -92,7 +94,7 @@ def run(self, edit):
if not region.empty():
text = ''
for c in self.view.substr(region):
if not re.match(pattern, c) and (c < 0x20 or c > 0x7e):
if not re.match(pattern, c) and (ord(c) < 0x20 or ord(c) > 0x7e):
text += '\\u{0:04X}'.format(ord(c))
else:
text += c
Expand Down

0 comments on commit cc66ba5

Please sign in to comment.