Skip to content

Commit cc66ba5

Browse files
committed
Merge pull request #9 from Vasfed/fix_unicode_st3
Fix unicode entities for python3
2 parents aa73216 + 0571e76 commit cc66ba5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stringutilities.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
import json
1616
import pprint
1717

18-
18+
if sys.hexversion >= 0x3000000:
19+
def unichr(c):
20+
return chr(c)
1921

2022

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

0 commit comments

Comments
 (0)