Index: django/core/template/defaultfilters.py
===================================================================
--- django/core/template/defaultfilters.py	(revision 1895)
+++ django/core/template/defaultfilters.py	(working copy)
@@ -1,7 +1,7 @@
 "Default variable filters"
 
 from django.core.template import resolve_variable, Library
-from django.conf.settings import DATE_FORMAT, TIME_FORMAT
+from django.conf.settings import DATE_FORMAT, TIME_FORMAT, DEFAULT_CHARSET
 from django.utils.translation import gettext
 import re
 import random as random_module
@@ -19,8 +19,12 @@
 
 def capfirst(value):
     "Capitalizes the first character of the value"
-    value = str(value)
-    return value and value[0].upper() + value[1:]
+    if not value:
+        return value
+    else:
+        value = str(value).decode(DEFAULT_CHARSET)
+        value = value[0].upper() + value[1:]
+        return value.encode(DEFAULT_CHARSET)
 
 def fix_ampersands(value):
     "Replaces ampersands with ``&amp;`` entities"
@@ -54,7 +58,7 @@
 
 def lower(value):
     "Converts a string into all lowercase"
-    return value.lower()
+    return str(value).decode(DEFAULT_CHARSET).lower().encode(DEFAULT_CHARSET)
 
 def make_list(value):
     """
@@ -84,7 +88,7 @@
 
 def title(value):
     "Converts a string into titlecase"
-    return re.sub("([a-z])'([A-Z])", lambda m: m.group(0).lower(), value.title())
+    return re.sub("([a-z])'([A-Z])", lambda m: m.group(0).lower(), str(value).decode(DEFAULT_CHARSET).title()).encode(DEFAULT_CHARSET)
 
 def truncatewords(value, arg):
     """
@@ -97,13 +101,11 @@
         length = int(arg)
     except ValueError: # invalid literal for int()
         return value # Fail silently.
-    if not isinstance(value, basestring):
-        value = str(value)
-    return truncate_words(value, length)
+    return truncate_words(str(value).decode(DEFAULT_CHARSET), length).encode(DEFAULT_CHARSET)
 
 def upper(value):
     "Converts a string into all uppercase"
-    return value.upper()
+    return str(value).decode(DEFAULT_CHARSET).upper().encode(DEFAULT_CHARSET)
 
 def urlencode(value):
     "Escapes a value for use in a URL"
@@ -136,7 +138,7 @@
     Argument: number of words to wrap the text at.
     """
     from django.utils.text import wrap
-    return wrap(str(value), int(arg))
+    return wrap(str(value).decode(DEFAULT_CHARSET), int(arg)).encode(DEFAULT_CHARSET)
 
 def ljust(value, arg):
     """
@@ -144,7 +146,7 @@
 
     Argument: field size
     """
-    return str(value).ljust(int(arg))
+    return str(value).decode(DEFAULT_CHARSET).ljust(int(arg)).encode(DEFAULT_CHARSET)
 
 def rjust(value, arg):
     """
@@ -152,11 +154,11 @@
 
     Argument: field size
     """
-    return str(value).rjust(int(arg))
+    return str(value).decode(DEFAULT_CHARSET).rjust(int(arg)).encode(DEFAULT_CHARSET)
 
 def center(value, arg):
     "Centers the value in a field of a given width"
-    return str(value).center(int(arg))
+    return str(value).decode(DEFAULT_CHARSET).center(int(arg)).encode(DEFAULT_CHARSET)
 
 def cut(value, arg):
     "Removes all values of arg from the given string"
@@ -236,10 +238,14 @@
 
 def length(value):
     "Returns the length of the value - useful for lists"
+    if isinstance(value,str):
+        value=value.decode(DEFAULT_CHARSET)
     return len(value)
 
 def length_is(value, arg):
     "Returns a boolean of whether the value's length is the argument"
+    if isinstance(value,str):
+        value=value.decode(DEFAULT_CHARSET)
     return len(value) == int(arg)
 
 def random(value):
