Changeset 628:447251b5af65 in documentViewer


Ignore:
Timestamp:
Feb 11, 2015, 4:18:23 PM (9 years ago)
Author:
casties
Branch:
default
Message:

make sure utf8ify and unicodify output text.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SrvTxtUtils.py

    r623 r628  
    2323import xml.etree.ElementTree as ET
    2424
    25 srvTxtUtilsVersion = "1.13"
     25srvTxtUtilsVersion = "1.13.1"
    2626
    2727map_months = {'en': [u"",
     
    9595        except:
    9696            return s.decode('latin-1')
     97    elif isinstance(s, unicode):
     98        return s
    9799    else:
    98         return s
     100        return unicode(s)
    99101
    100102def utf8ify(s):
     
    103105    if not s:
    104106        return ""
    105     if isinstance(s, str):
     107    if isinstance(s, unicode):
     108        return s.encode('utf-8')
     109    elif isinstance(s, str):
    106110        return s
    107111    else:
    108         return s.encode('utf-8')
     112        return str(s)
    109113
    110114
Note: See TracChangeset for help on using the changeset viewer.