mirror of
https://github.com/django/django.git
synced 2024-12-26 11:06:07 +00:00
Removed utils.text.fix_microsoft_characters, which didn't actually do anything. Refs #467.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6e034a831a
commit
99e0f7a932
@ -1,7 +1,6 @@
|
||||
from django.core import validators
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.utils.html import escape
|
||||
from django.utils.text import fix_microsoft_characters
|
||||
|
||||
FORM_FIELD_ID_PREFIX = 'id_'
|
||||
|
||||
@ -242,8 +241,6 @@ class TextField(FormField):
|
||||
self.field_name, self.length, escape(data), maxlength)
|
||||
|
||||
def html2python(data):
|
||||
if data:
|
||||
return fix_microsoft_characters(data)
|
||||
return data
|
||||
html2python = staticmethod(html2python)
|
||||
|
||||
|
@ -40,35 +40,6 @@ def get_valid_filename(s):
|
||||
s = s.strip().replace(' ', '_')
|
||||
return re.sub(r'[^-A-Za-z0-9_.]', '', s)
|
||||
|
||||
def fix_microsoft_characters(s):
|
||||
"""
|
||||
Converts Microsoft proprietary characters (e.g. smart quotes, em-dashes)
|
||||
to sane characters
|
||||
"""
|
||||
# Sources:
|
||||
# http://stsdas.stsci.edu/bps/pythontalk8.html
|
||||
# http://www.waider.ie/hacks/workshop/perl/rss-fetch.pl
|
||||
# http://www.fourmilab.ch/webtools/demoroniser/
|
||||
return s
|
||||
s = s.replace('\x91', "'")
|
||||
s = s.replace('\x92', "'")
|
||||
s = s.replace('\x93', '"')
|
||||
s = s.replace('\x94', '"')
|
||||
s = s.replace('\xd2', '"')
|
||||
s = s.replace('\xd3', '"')
|
||||
s = s.replace('\xd5', "'")
|
||||
s = s.replace('\xad', '--')
|
||||
s = s.replace('\xd0', '--')
|
||||
s = s.replace('\xd1', '--')
|
||||
s = s.replace('\xe2\x80\x98', "'") # weird single quote (open)
|
||||
s = s.replace('\xe2\x80\x99', "'") # weird single quote (close)
|
||||
s = s.replace('\xe2\x80\x9c', '"') # weird double quote (open)
|
||||
s = s.replace('\xe2\x80\x9d', '"') # weird double quote (close)
|
||||
s = s.replace('\xe2\x81\x84', '/')
|
||||
s = s.replace('\xe2\x80\xa6', '...')
|
||||
s = s.replace('\xe2\x80\x94', '--')
|
||||
return s
|
||||
|
||||
def get_text_list(list_, last_word='or'):
|
||||
"""
|
||||
>>> get_text_list(['a', 'b', 'c', 'd'])
|
||||
|
Loading…
Reference in New Issue
Block a user