Staging
v0.5.0
v0.5.0
https://foss.heptapod.net/mercurial/hgview
Tip revision: b71e0bab8c2f62e9c1a7e297e0c72f95e773f7ed authored by David Douard on 05 June 2009, 11:41:34 UTC
close new_qt_ui branche (it's now teh default branch)
close new_qt_ui branche (it's now teh default branch)
Tip revision: b71e0ba
util.py
# -*- coding: utf-8 -*-
# util functions
#
# Copyright (C) 2009 Logilab. All rights reserved.
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
def tounicode(s):
"""
Tries to convert s into a unicode string
"""
for encoding in ('utf-8', 'iso-8859-15', 'cp1252'):
try:
return unicode(s, encoding)
except UnicodeDecodeError:
pass
return unicode(s, 'utf-8', 'replace')