fix router code for non-latin1 chars -- should fix #401

Please, consider applying