Show More
@@ -0,0 +1,26 b'' | |||
|
1 | #require test-repo hg10 | |
|
2 | ||
|
3 | $ . "$TESTDIR/helpers-testrepo.sh" | |
|
4 | ||
|
5 | $ cat > $TESTTMP/check_ascii.py <<EOF | |
|
6 | > import sys | |
|
7 | > for file_path in sys.argv[1:]: | |
|
8 | > with open(file_path, 'br') as f: | |
|
9 | > try: | |
|
10 | > f.read().decode('ascii', 'strict') | |
|
11 | > except UnicodeDecodeError as exc: | |
|
12 | > print('%s: %s' % (file_path, exc)) | |
|
13 | > EOF | |
|
14 | ||
|
15 | There are some web servers in the wild that can serve static files with an | |
|
16 | incorrect encoding (e.g. https://bz.mercurial-scm.org/show_bug.cgi?id=6559). | |
|
17 | One way to prevent any issues is to not use any non-ASCII characters, e.g. | |
|
18 | URL-encoding them or using HTML entities. | |
|
19 | ||
|
20 | check charset of all tracked files ending in .js | |
|
21 | ||
|
22 | $ cd "`dirname "$TESTDIR"`" | |
|
23 | ||
|
24 | $ testrepohg locate 'set:**.js' \ | |
|
25 | > 2>/dev/null \ | |
|
26 | > | xargs "$PYTHON" $TESTTMP/check_ascii.py |
General Comments 0
You need to be logged in to leave comments.
Login now