you need to handle the case of returning false (i.e. not able to detect the encoding)