##// END OF EJS Templates
add ascii_only filter
MinRK -
Show More
@@ -62,6 +62,7 b' default_filters = {'
62 62 'citation2latex': filters.citation2latex,
63 63 'path2url': filters.path2url,
64 64 'add_prompts': filters.add_prompts,
65 'ascii_only': filters.ascii_only,
65 66 }
66 67
67 68 #-----------------------------------------------------------------------------
@@ -43,7 +43,8 b' __all__ = ['
43 43 'ipython2python',
44 44 'posix_path',
45 45 'path2url',
46 'add_prompts'
46 'add_prompts',
47 'ascii_only',
47 48 ]
48 49
49 50
@@ -213,3 +214,8 b' def path2url(path):'
213 214 """Turn a file path into a URL"""
214 215 parts = path.split(os.path.sep)
215 216 return '/'.join(quote(part) for part in parts)
217
218 def ascii_only(s):
219 """ensure a string is ascii"""
220 s = py3compat.cast_unicode(s)
221 return s.encode('ascii', 'replace').decode('ascii') No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now