improve text encoding guessing from byte buffer.