bugfixes for windows, using charade instead of chardet, which mysteriously only works in linux