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