diff --git a/Tools/Documentation/preprocess/003.make_headers.rb b/Tools/Documentation/preprocess/003.make_headers.rb index 2cf277fa9..817972e58 100755 --- a/Tools/Documentation/preprocess/003.make_headers.rb +++ b/Tools/Documentation/preprocess/003.make_headers.rb @@ -5,6 +5,9 @@ # $1 Cappuccino documentation directory +Encoding.default_external = 'UTF-8' + + ACCESSOR_GET_TEMPLATE = < 'UTF-8') source = sourceFile.read sourceFile.close() @@ -51,7 +54,7 @@ def makeHeaderFileFrom(fileName) source.gsub!(/^\s*(@implementation \s*\w+(?:\s*:\s*\w+)?)\n(\s*[^{])/, "\\1\n{\n#{DUMMY_IVAR}\n}\n\\2") source.gsub!(/^\s*(@implementation \s*\w+(?:\s*:\s*\w+)?)\n\s*\{\s*\}/, "\\1\n{\n#{DUMMY_IVAR}\n}") - sourceFile = File.new(fileName, "w") + sourceFile = File.new(fileName, "w", :encoding => 'UTF-8') # Remove @accessor declarations from ivars before writing the source file sourceFile.write(source.gsub(/(\s*\w+\s+\w+)\s+@accessors(\(.+?\))?;/m, "\\1;")) diff --git a/Tools/Documentation/support/massage_text.py b/Tools/Documentation/support/massage_text.py index 2efdc8a0b..061676d7b 100755 --- a/Tools/Documentation/support/massage_text.py +++ b/Tools/Documentation/support/massage_text.py @@ -28,10 +28,15 @@ transforms = [ html = glob.glob(os.path.join(sys.argv[1], "*.html")) for count, filename in enumerate(html): - f = open(filename, "r+") - text = f.read() + try: + # For some reason we get some UTF errors in the output HTML. Ignoring them should be fine. + f = open(filename, "r+", encoding='UTF-8', errors='ignore') + text = f.read() + except: + print("Failed to read %s." % filename) + raise + i = 0 - while i < len(transforms): text = transforms[i].sub(transforms[i + 1], text) i += 2