Fix encoding test to reflect browser behaviour

Tested with Chrome.