Classic ASP IsNumeric weirdness?

ExpelaEtege

New Member
Just ran into a rather strange bit of functionality with the baked in IsNumeric function is classic ASP.I had a JSONArray class that prints out its contents to a string - it was using \[code\]IsNumeric\[/code\] to determine whether or not to escape values with \[code\]"\[/code\]'s. Everything was working fine until today a client reported a previously unseen error!After some digging I found that a handful of records in the JSON array that was being returned from an AJAX call were poorly formed. More digging. Turns out strings that were formatted similar to \[code\]'2D25'\[/code\] would be evaluated as numeric by \[code\]IsNumeric\[/code\] and therefore not be escaped!Does anyone know why this is? Does ASP think the \[code\]D\[/code\] is interchangeable with a \[code\].\[/code\]?Also, how should I go about fixing this? Would a regular expression be a better solution?Thanks!
 
Back
Top