Removing unsafe ascii characters from a string
Last night I was working on a Mobile application that gets is data via a web service. This web service returns JSON by turning a record set into JSON using the serlializeJSON() function that is built into ColdFusion.
Whenever I am dealing with JSON I like to validate it before I start using it in an application. A great resource for validating data is http://jsonlint.com/. The data I was trying to get just was not validating and we couldn't figure out why. It seem to keep complaining about the bio of the speaker. This data for this was produced by the end user. In the end Elliott realized that it was unsafe characters in the Bio that was throwing everything off. He used this code to fix the issue and the json was now validating.
I was going to explain how this works but my friend Ben Nadel has a whole post on this you should really check out. Basically all the code above is doing is removing an un safe character that does not fall in between the "safe" ascii codes of 1-127.
