Changeset 385
- Timestamp:
- Mon Mar 17 23:47:07 2008
- Files:
-
- server/trunk/update/server/HTML.py (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
server/trunk/update/server/HTML.py
r364 r385 1 1 # Export as HTML.py 2 # Copyright 2004, 2005, 2006 by Brian C. Christensen 2 # Copyright 2004, 2005, 2006, 2008 by Brian C. Christensen 2 2 3 3 # This file is part of GanttPV. … … 42 42 # 060914 - Alex - use time-scale headers from Data (takes advantage of the better-looking headers in v0.7) 43 43 # 080107 - Brian - move index reports to separate module 44 # 080305 - Brian - always export as utf-8 44 45 45 46 # Note: The fonts used in this script are larger than in GanttPV. To reduce font size to more closely match GanttPV, change the "font-size" lines in the header strings. … … 64 65 debug = 1 65 66 66 xchar = { } 67 if convert: 68 cset = "windows-1257" 69 xchar = { 70 u'\u0105': '\xe0', 71 u'\u010C': '\xd0', 72 u'\u010D': '\xe8', 73 u'\u0117': '\xeb', 74 u'\u012F': '\xe1', 75 u'\u0160': '\xd0', 76 u'\u0161': '\xf0', 77 u'\u016B': '\xfb', 78 u'\u0173': '\xf8', 79 u'\u017E': '\xfe', 80 } 81 else: 82 cset = "iso-8859-1" 67 ##xchar = { } 68 ##if convert: 69 ## cset = "windows-1257" 70 ## xchar = { 71 ## u'\u0105': '\xe0', 72 ## u'\u010C': '\xd0', 73 ## u'\u010D': '\xe8', 74 ## u'\u0117': '\xeb', 75 ## u'\u012F': '\xe1', 76 ## u'\u0160': '\xd0', 77 ## u'\u0161': '\xf0', 78 ## u'\u016B': '\xfb', 79 ## u'\u0173': '\xf8', 80 ## u'\u017E': '\xfe', 81 ## } 82 ##else: 83 ## cset = "iso-8859-1" 84 85 cset = "utf-8" # alway export as utf-8 83 86 84 87 if wrapcells: … … 101 104 result = str(value) 102 105 else: 103 result = "?" 104 try: 105 result = str(value) 106 except UnicodeEncodeError: # fix european conversion errors 107 result = '' 108 for ch in value: 109 if ord(ch) < 128: 110 ch = chr(ord(ch)) 111 elif ch in '><"&': 112 ch = "&#" + chr(ord(ch)) + ";" 113 elif xchar.has_key(ch): 114 ch = xchar[ch] 115 #if len(xchar[ch]) == 1: 116 # xchar[ch] 117 # # ch = "&#" + chr(ord(xchar[ch])) + ";" 118 #else: 119 # ch = xchar[ch] 120 elif ord(ch) >= 128 and ord(ch) < 255: 121 ch = "&#" + chr(ord(ch)) + ";" 122 else: 123 ch = "?" 124 result += ch 106 ## result = "?" 107 ## try: 108 result = value.encode( "utf-8" ) 109 ## except UnicodeEncodeError: # fix european conversion errors 110 ## result = '' 111 ## for ch in value: 112 ## if ord(ch) < 128: 113 ## ch = chr(ord(ch)) 114 ## elif ch in '><"&': 115 ## ch = "&#" + chr(ord(ch)) + ";" 116 ## elif xchar.has_key(ch): 117 ## ch = xchar[ch] 118 ## #if len(xchar[ch]) == 1: 119 ## # xchar[ch] 120 ## # # ch = "&#" + chr(ord(xchar[ch])) + ";" 121 ## #else: 122 ## # ch = xchar[ch] 123 ## elif ord(ch) >= 128 and ord(ch) < 255: 124 ## ch = "&#" + chr(ord(ch)) + ";" 125 ## else: 126 ## ch = "?" 127 ## result += ch 125 128 return result 126 129
