aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/util/encoding.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2011-11-13 21:06:43 -0500
committerW. Trevor King <wking@drexel.edu>2011-11-13 21:06:43 -0500
commit6f2d652b2697d7aec6bb48a2bf4d6fff1ef03521 (patch)
tree4b6e99206fcc0e810172104230246684ae6cac36 /libbe/util/encoding.py
parent567c3151cab38140eb40eb2b0a08ba0c2ac6ec89 (diff)
downloadbugseverywhere-6f2d652b2697d7aec6bb48a2bf4d6fff1ef03521.tar.gz
Fix my busted 1512c0e2a64e patch to libbe/util/encoding.py.
Some temporary changes to encoding.py seem to have been added to commit 1512c0e2a64e19c8d4e5697257a4df5ddd8bc727 Author: W. Trevor King <wking@drexel.edu> Date: Tue Nov 8 07:14:43 2011 -0500 by accident. The initial change came from discussions with Niall Douglas, during which I realized that "filesystem encoding" ususally means the encoding for the *path*, not the *contents*. To avoid further confusion I'd renamed `get_filesystem_encoding` to the less ambiguous `get_text_file_encoding`. This commit should complete the transition.
Diffstat (limited to 'libbe/util/encoding.py')
-rw-r--r--libbe/util/encoding.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/libbe/util/encoding.py b/libbe/util/encoding.py
index 8663744..949b3ce 100644
--- a/libbe/util/encoding.py
+++ b/libbe/util/encoding.py
@@ -54,7 +54,7 @@ def get_output_encoding():
def get_text_file_encoding():
"""Return the encoding that should be used for file contents
"""
- return 'utf-8'
+ return get_encoding()
def get_argv_encoding():
return get_encoding()
@@ -75,7 +75,7 @@ def known_encoding(encoding):
def get_file_contents(path, mode='r', encoding=None, decode=False):
if decode == True:
if encoding == None:
- encoding = get_filesystem_encoding()
+ encoding = get_text_file_encoding()
f = codecs.open(path, mode, encoding)
else:
f = open(path, mode)
@@ -86,7 +86,7 @@ def get_file_contents(path, mode='r', encoding=None, decode=False):
def set_file_contents(path, contents, mode='w', encoding=None):
if type(contents) == types.UnicodeType:
if encoding == None:
- encoding = get_filesystem_encoding()
+ encoding = get_text_file_encoding()
f = codecs.open(path, mode, encoding)
else:
f = open(path, mode)