Today I came across an interesting bug in a codeigniter application I was working on where I encoded ampersands (&) were appearing in a report. I did some rudimentary debugging and realised that for some reason, values from a form were being saved to the database html encoded. I stepped through the code and discovered …