Add test for when declared encoding disagrees with previously-detected encoding.
Credit @haarg and Pat Dumas.