def parse_to_slug(words, maxlen=24):
    """
	Parse a string into a slug format suitable for use in URLs and other
	character restricted applications. Only utf-8 strings are supported at this
	time.

	:param str words: The words to parse.
	:param int maxlen: The maximum length of the slug.
	:return: The parsed words as a slug.
	:rtype: str
	"""
    slug = ''
    maxlen = min(maxlen, len(words))
    for c in words:
        if len(slug) == maxlen:
            break
        c = ord(c)
        if c == 39:
            continue
        elif c >= 48 and c <= 57:
            slug += chr(c)
        elif c >= 65 and c <= 90:
            slug += chr(c + 32)
        elif c >= 97 and c <= 122:
            slug += chr(c)
        elif len(slug) and slug[-1] != '-':
            slug += '-'
    if len(slug) and slug[-1] == '-':
        slug = slug[:-1]
    return slug
