From 99e0f7a93275b8384085d3b2b397415e2064b4d7 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Tue, 13 Sep 2005 03:28:34 +0000 Subject: [PATCH] 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 --- django/core/formfields.py | 3 --- django/utils/text.py | 29 ----------------------------- 2 files changed, 32 deletions(-) diff --git a/django/core/formfields.py b/django/core/formfields.py index 745f52036f..3bc315161f 100644 --- a/django/core/formfields.py +++ b/django/core/formfields.py @@ -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) diff --git a/django/utils/text.py b/django/utils/text.py index d8b2e16e82..3185308064 100644 --- a/django/utils/text.py +++ b/django/utils/text.py @@ -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'])