55:b5c84934de9c | 56:3bd61d38c924 |
---|---|
265 # Save as UTF-8 without BOM | 265 # Save as UTF-8 without BOM |
266 etext, encoding = text.encode('utf-8'), 'utf-8' | 266 etext, encoding = text.encode('utf-8'), 'utf-8' |
267 | 267 |
268 return etext, encoding | 268 return etext, encoding |
269 | 269 |
270 _escape = re.compile(eval(r'"[&<>\"\u0080-\uffff]"')) | 270 _escape = re.compile("[&<>\"\u0080-\uffff]") |
271 | 271 |
272 _escape_map = { | 272 _escape_map = { |
273 "&": "&", | 273 "&": "&", |
274 "<": "<", | 274 "<": "<", |
275 ">": ">", | 275 ">": ">", |
301 if not text: | 301 if not text: |
302 return "" | 302 return "" |
303 text = pattern.sub(escape_entities, text) | 303 text = pattern.sub(escape_entities, text) |
304 return text | 304 return text |
305 | 305 |
306 _uescape = re.compile(r'[\u0080-\uffff]') | 306 _uescape = re.compile('[\u0080-\uffff]') |
307 | 307 |
308 def escape_uentities(m): | 308 def escape_uentities(m): |
309 """ | 309 """ |
310 Function to encode html entities. | 310 Function to encode html entities. |
311 | 311 |