Fixed detect charset on encoded
Removed debug code