Browse Source

Cleanup find_non_ascii.py script

pull/113/head
Sami Vaarala 10 years ago
parent
commit
50dbbf4a50
  1. 18
      util/find_non_ascii.py

18
util/find_non_ascii.py

@ -1,15 +1,18 @@
#!/usr/bin/python
#
# $ for i in *.js; do python findnonascii.py $i; done
# Example:
#
# $ for i in ecmascript-testcases/*.js; do python util/find_non_ascii.py $i; done
#
import os, sys
f = open(sys.argv[1], 'rb')
data = f.read()
f.close()
def main():
f = open(sys.argv[1], 'rb')
data = f.read()
f.close()
for linenum, linedata in enumerate(data.split('\n')):
for linenum, linedata in enumerate(data.split('\n')):
non_ascii = False
for i in xrange(len(linedata)):
x = ord(linedata[i])
@ -17,3 +20,6 @@ for linenum, linedata in enumerate(data.split('\n')):
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()

Loading…
Cancel
Save