Fix encoding problem in the Apache autodetection code. Fixes issue #1026.