Index: django/core/template/defaultfilters.py
===================================================================
--- django/core/template/defaultfilters.py	(revision 1461)
+++ 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
 import re
 import random as random_module
 
@@ -18,8 +18,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"
@@ -53,7 +57,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):
     """
@@ -83,7 +87,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):
     """
@@ -96,13 +100,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"
@@ -134,7 +136,7 @@
     Argument: number of words to wrap the text at.
     """
     from django.utils.text import wrap
-    return wrap(value, int(arg))
+    return wrap(str(value).decode(DEFAULT_CHARSET), int(arg)).encode(DEFAULT_CHARSET)
 
 def ljust(value, arg):
     """
@@ -142,7 +144,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):
     """
@@ -150,11 +152,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"
@@ -234,10 +236,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):
