from django.db.models import signals from django.dispatch import dispatcher from django.db import models def kill_gremlins(text): return unicode(text).encode('iso-8859-1').decode('cp1252') def charstrip(sender, instance): for i_attr in instance._meta.fields: if type(i_attr) == models.TextField or type(i_attr) == models.CharField: if getattr(instance, i_attr.name): setattr(instance, i_attr.name, kill_gremlins(getattr(instance, i_attr.name))) dispatcher.connect(charstrip, signal=signals.pre_save)