Wednesday, February 25, 2015

Daily Lesson 2 of 2 : Output format of queries

So I was debugging an issue with a service that process data from a db table. I created a quick unit test, queried for the data, copied the results, pasted into the test and found nothing wrong.


A colleague was at my desk for something else and witnessed what I was doing, he reminded me to switch my query output to output text instead of the table format because the table output doesn't display all characters. It missed things like newlines and control chats...AHA! There was the new line in the subject data for an email! Now I had it and was able to prove that it was the culprit.


But now I have to ask why it was there to begin with! Sanitize user supplied data. If the target is a email subject, remove invalid newline chars.

No comments:

Post a Comment