Skip to content
Snippets Groups Projects
Commit c6543c4d authored by George Nachman's avatar George Nachman
Browse files

Use unicode.org's list of IDN characters instead of alphaNumeric characters as...

Use unicode.org's list of IDN characters instead of alphaNumeric characters as the list of legal URL haracters, plus those in settings for various punctuation marks like / which can occur in a URL
parent 90af03c6
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
import itertools
def get_ranges(i):
for a, b in itertools.groupby(enumerate(i), lambda (x, y): y - x):
b = list(b)
yield b[0][1], b[-1][1]
contents = []
while True:
try:
line = raw_input("")
except EOFError:
break
contents.append(line)
numbers = map(lambda x: int(x, 16), contents)
for x in get_ranges(numbers):
print "[set addCharactersInRange:NSMakeRange(%s, %s)];" % (hex(x[0]), str(x[1] - x[0] + 1))
#!/usr/bin/python
import itertools
def get_ranges(i):
for a, b in itertools.groupby(enumerate(i), lambda (x, y): y - x):
b = list(b)
yield b[0][1], b[-1][1]
contents = []
while True:
try:
line = raw_input("").split(" ")
except EOFError:
break
contents.append(line)
for tuple in contents:
min = int(tuple[0], 16)
max = int(tuple[1], 16)
print "[set addCharactersInRange:NSMakeRange(%s, %s)];" % (hex(min), str(max - min + 1))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment