Skip to content

Commit

Permalink
SVM doc: Fix UTF-8 with BOM error
Browse files Browse the repository at this point in the history
The cmake build system errors when a file contains UTF-8 BOM, as was
the case in the recently committed SVM file.

Other changes:
    - Cleaned the SVM documentation and moved output tables info after the
    arguments list.
    - Changed the string formatting in BOM check script since Python version on
    build server could be prior to 2.6.
  • Loading branch information
Rahul Iyer committed Aug 11, 2015
1 parent 9633a99 commit f626970
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 141 deletions.
9 changes: 5 additions & 4 deletions cmake/TestIfNoUTF8BOM.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import sys


def detectBOM(inFileName):
file = open(inFileName, 'r')
file.seek(0)
Expand All @@ -18,16 +19,16 @@ def detectBOM(inFileName):
else:
return "unknown"

def main(argv = None):

def main(argv=None):
if argv is None:
argv = sys.argv
BOM = detectBOM(argv[1])
if BOM != "utf_8":
return 0
else:
print 'Detected byte-order mark ({0}) in file "{1}".'.format(
BOM, argv[1])
print 'Detected byte-order mark (%s) in file "%s".' % (BOM, argv[1])
return 1

if __name__ == '__main__':
sys.exit(main())
Loading

0 comments on commit f626970

Please sign in to comment.