Fixed a bug that caused an exception to be thrown if no encoding was detected.