aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/encoding.py
diff options
context:
space:
mode:
authorChris Ball <cjb@laptop.org>2009-10-05 23:15:39 -0400
committerChris Ball <cjb@laptop.org>2009-10-05 23:15:39 -0400
commitb6a50c703369467132876f21efa8e4ffc672afae (patch)
tree905a9ae34efa2bce47d754893093b016d18d0162 /libbe/encoding.py
parent6a639574fa95e50f82fa3052e5524b961295a7ab (diff)
parente35ccf95ea89b6e622202caae30d3b8cca3f2473 (diff)
downloadbugseverywhere-b6a50c703369467132876f21efa8e4ffc672afae.tar.gz
Large merge from W. Trevor King, including Gianluca's HTML export.
Diffstat (limited to 'libbe/encoding.py')
-rw-r--r--libbe/encoding.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/libbe/encoding.py b/libbe/encoding.py
index d603602..fd513b5 100644
--- a/libbe/encoding.py
+++ b/libbe/encoding.py
@@ -14,16 +14,26 @@
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""
+Support input/output/filesystem encodings (e.g. UTF-8).
+"""
+
import codecs
import locale
import sys
import doctest
+
+ENCODING = None # override get_encoding() output by setting this
+
def get_encoding():
"""
Guess a useful input/output/filesystem encoding... Maybe we need
seperate encodings for input/output and filesystem? Hmm...
"""
+ if ENCODING != None:
+ return ENCODING
encoding = locale.getpreferredencoding() or sys.getdefaultencoding()
if sys.platform != 'win32' or sys.version_info[:2] > (2, 3):
encoding = locale.getlocale(locale.LC_TIME)[1] or encoding