def build_content_type(format, encoding=u'utf-8'):
 if (u'charset' in format):
  return format
 if (format in (u'application/json', u'text/javascript')):
  return format
 return (u'%s; charset=%s' % (format, encoding))

def build_content_type ( format , encoding = u'utf-8' ) : if ( u'charset' in format ) : return format if ( format in ( u'application/json' , u'text/javascript' ) ) : return format return ( u'%s; charset=%s' % ( format , encoding ) )
appends character encoding to the provided format if not already present .