Fix as jroper suggested
Add test for invalid encoded character
Change test to new pattern