diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index 47e116c..0fabe84 100644
a
|
b
|
def filesizeformat(bytes):
|
791 | 791 | """ |
792 | 792 | try: |
793 | 793 | bytes = float(bytes) |
794 | | except TypeError: |
| 794 | except (TypeError,ValueError,UnicodeDecodeError): |
795 | 795 | return u"0 bytes" |
796 | 796 | |
797 | 797 | if bytes < 1024: |
diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py
index 4343586..0fe4673 100644
a
|
b
|
u'1024.0 MB'
|
476 | 476 | >>> filesizeformat(1024*1024*1024) |
477 | 477 | u'1.0 GB' |
478 | 478 | |
| 479 | >>> filesizeformat(complex(1,-1)) |
| 480 | u'0 bytes' |
| 481 | |
| 482 | >>> filesizeformat("") |
| 483 | u'0 bytes' |
| 484 | |
| 485 | >>> filesizeformat(u"\N{GREEK SMALL LETTER ALPHA}") |
| 486 | u'0 bytes' |
| 487 | |
479 | 488 | >>> pluralize(1) |
480 | 489 | u'' |
481 | 490 | |