diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-03-29 22:17:20 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-03-29 22:17:20 -0700 |
commit | 4a1b03a499dd07c37628f0bae8e36b9deaf1c7d4 (patch) | |
tree | ff33111291f67ede32da4ab4ed3b1ff652336a0d /scss/cssdefs.py | |
parent | 5ba6063e623c8f6726479682bcdfd3f5923f33ee (diff) | |
download | pyscss-4a1b03a499dd07c37628f0bae8e36b9deaf1c7d4.tar.gz |
Write CSS out in the same encoding it claims to be.
Diffstat (limited to 'scss/cssdefs.py')
-rw-r--r-- | scss/cssdefs.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/scss/cssdefs.py b/scss/cssdefs.py index 398a4cc..e312ca5 100644 --- a/scss/cssdefs.py +++ b/scss/cssdefs.py @@ -347,16 +347,12 @@ def is_builtin_css_function(name): # CSS character set determination # Based upon: http://www.w3.org/TR/CSS2/syndata.html#charset -def determine_encoding(f): - """Return the appropriate encoding for the given file, according to the CSS - charset rules. +def determine_encoding(buf): + """Return the appropriate encoding for the given CSS source, according to + the CSS charset rules. - `f` should be a file-like object with the cursor at the beginning. + `buf` may be either a string or bytes. """ - # 200 bytes should be enough for anyone - buf = f.read(200) - f.seek(0) - # The ultimate default is utf8; bravo, W3C bom_encoding = 'UTF-8' |