Permalink
Browse files

BOM_UTF8 is actually the first byte, not the last

  • Loading branch information...
1 parent 1febbe3 commit 8fedb758d6d7b7a45e4f9f7fd2b638cd0759db37 @posativ committed Mar 23, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 acrylamid/readers.py
View
@@ -22,7 +22,8 @@
from acrylamid import log
from acrylamid.errors import AcrylamidException
-from acrylamid.utils import cached_property, Metadata, istext, rchop, force_unicode as u
+from acrylamid.utils import (cached_property, Metadata, istext, rchop, lchop,
+ force_unicode as u)
from acrylamid.core import cache
from acrylamid.filters import FilterTree
from acrylamid.helpers import safeslug, expand, hash
@@ -269,7 +270,7 @@ def __init__(self, path, conf):
with io.open(path, 'r', encoding='utf-8', errors='replace') as fp:
- peak = rchop(fp.read(512), BOM_UTF8)
+ peak = lchop(fp.read(512), BOM_UTF8)
fp.seek(0)
if peak.startswith('---\n'):
@@ -312,7 +313,7 @@ def lastmodified(self):
def source(self):
"""Returns the actual, unmodified content."""
with io.open(self.filename, 'r', encoding='utf-8') as f:
- return rchop(''.join(f.readlines()[self.offset:]).strip(), BOM_UTF8)
+ return lchop(''.join(f.readlines()[self.offset:]).strip(), BOM_UTF8)
def __hash__(self):
return self.hashvalue

0 comments on commit 8fedb75

Please sign in to comment.