aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--screenplain/main.py2
-rw-r--r--tests/files/utf-8-bom.fountain18
-rw-r--r--tests/files/utf-8-bom.fountain.fdx43
-rw-r--r--tests/files/utf-8-bom.fountain.html6
4 files changed, 68 insertions, 1 deletions
diff --git a/screenplain/main.py b/screenplain/main.py
index ac308b5..43e44a1 100644
--- a/screenplain/main.py
+++ b/screenplain/main.py
@@ -75,7 +75,7 @@ def main(args):
)
if input_file:
- input = codecs.open(input_file, 'r', 'utf-8')
+ input = codecs.open(input_file, 'r', 'utf-8-sig')
else:
input = codecs.getreader('utf-8')(sys.stdin)
screenplay = fountain.parse(input)
diff --git a/tests/files/utf-8-bom.fountain b/tests/files/utf-8-bom.fountain
new file mode 100644
index 0000000..ddfe1f9
--- /dev/null
+++ b/tests/files/utf-8-bom.fountain
@@ -0,0 +1,18 @@
+EXT. SOMEWHERE - DAY
+
+GUY and GURL walk down the street.
+
+It's a sunny day.
+Sunnier than normal.
+Too sunny to be funny.
+
+GUY
+So what's up?
+
+GURL
+Nothing much.
+Just thinking.
+And you?
+
+GUY
+Nothing. \ No newline at end of file
diff --git a/tests/files/utf-8-bom.fountain.fdx b/tests/files/utf-8-bom.fountain.fdx
new file mode 100644
index 0000000..9701f3a
--- /dev/null
+++ b/tests/files/utf-8-bom.fountain.fdx
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<FinalDraft DocumentType="Script" Template="No" Version="1">
+
+ <Content>
+ <Paragraph Type="Scene Heading">
+ <Text>EXT. SOMEWHERE - DAY</Text>
+ </Paragraph>
+ <Paragraph Type="Action">
+ <Text>GUY and GURL walk down the street.</Text>
+ </Paragraph>
+ <Paragraph Type="Action">
+ <Text>It's a sunny day.
+</Text>
+ <Text>Sunnier than normal.
+</Text>
+ <Text>Too sunny to be funny.</Text>
+ </Paragraph>
+ <Paragraph Type="Character">
+ <Text>GUY</Text>
+ </Paragraph>
+ <Paragraph Type="Dialogue">
+ <Text>So what's up?</Text>
+ </Paragraph>
+ <Paragraph Type="Character">
+ <Text>GURL</Text>
+ </Paragraph>
+ <Paragraph Type="Dialogue">
+ <Text>Nothing much.</Text>
+ </Paragraph>
+ <Paragraph Type="Dialogue">
+ <Text>Just thinking.</Text>
+ </Paragraph>
+ <Paragraph Type="Dialogue">
+ <Text>And you?</Text>
+ </Paragraph>
+ <Paragraph Type="Character">
+ <Text>GUY</Text>
+ </Paragraph>
+ <Paragraph Type="Dialogue">
+ <Text>Nothing.</Text>
+ </Paragraph>
+ </Content>
+</FinalDraft>
diff --git a/tests/files/utf-8-bom.fountain.html b/tests/files/utf-8-bom.fountain.html
new file mode 100644
index 0000000..70043dd
--- /dev/null
+++ b/tests/files/utf-8-bom.fountain.html
@@ -0,0 +1,6 @@
+<h6>EXT. SOMEWHERE - DAY</h6>
+<div class="action"><p>GUY and GURL walk down the street.</p></div>
+<div class="action"><p>It's a sunny day.<br/>Sunnier than normal.<br/>Too sunny to be funny.</p></div>
+<div class="dialog"><p class="character">GUY</p><p>So what's up?</p></div>
+<div class="dialog"><p class="character">GURL</p><p>Nothing much.</p><p>Just thinking.</p><p>And you?</p></div>
+<div class="dialog"><p class="character">GUY</p><p>Nothing.</p></div>