mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
625 B
25 lines
625 B
#!/usr/bin/env python2
|
|
#
|
|
# Example:
|
|
#
|
|
# $ for i in tests/ecmascript/*.js; do python util/find_non_ascii.py $i; done
|
|
#
|
|
|
|
import os, sys
|
|
|
|
def main():
|
|
f = open(sys.argv[1], 'rb')
|
|
data = f.read()
|
|
f.close()
|
|
|
|
for linenum, linedata in enumerate(data.split('\n')):
|
|
non_ascii = False
|
|
for i in xrange(len(linedata)):
|
|
x = ord(linedata[i])
|
|
if x >= 0x80:
|
|
print '%s: non-ascii data on line %d, char index %d, value %d (0x%02x)' % \
|
|
(sys.argv[1], linenum + 1, i + 1, x, x)
|
|
non_ascii = True
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|