code: def sortable_title(portal, title):
      if not title:
          return ''
      def_charset = portal.plone_utils.getSiteEncoding()
      sortabletitle = str(title.lower().strip())
      sortabletitle = num_sort_regex.sub(zero_fill, sortabletitle)
      for charset in [def_charset, 'latin-1', 'utf-8']:
          try:
              sortabletitle = safe_unicode(sortabletitle, charset)[:30]
              sortabletitle = sortabletitle.encode(def_charset or 'utf-8')
              break
          except UnicodeError:
              pass
          except TypeError:
              sortabletitle = sortabletitle[:30]
              break
      return sortabletitle