Detect between UTF-8 and ISO8859-1 encodings

You get all kind of crap from IRC, attempt to ensure it's received correctly.
However, because samples of texts are often very small (one or two words are
common), we can't really detect all the different encodings here. Hence,
default to doing what works best for me: attempt to detect UTF-8 and if it's
not valid UTF-8, always assume it's ISO8859-1.

Signed-off-by: Aki Saarinen <aki@akisaarinen.fi>
Fix URL redirection errors

In case the server didn't send the full URL, redirection tracker failed.

Signed-off-by: Aki Saarinen <aki@akisaarinen.fi>