'Extend a string-type declaration with standard SQL CHARACTER SET /
COLLATE annotations and MySQL specific extensions.'

def _extend_string(self, type_, defaults, spec):

    def attr(name):
        return getattr(type_, name, defaults.get(name))
    if attr('charset'):
        charset = ('CHARACTER    SET    %s' % attr('charset'))
    elif attr('ascii'):
        charset = 'ASCII'
    elif attr('unicode'):
        charset = 'UNICODE'
    else:
        charset = None
    if attr('collation'):
        collation = ('COLLATE    %s' % type_.collation)
    elif attr('binary'):
        collation = 'BINARY'
    else:
        collation = None
    if attr('national'):
        return '    '.join([c for c in ('NATIONAL', spec, collation) if (c is not None)])
    return '    '.join([c for c in (spec, charset, collation) if (c is not None)])
