I'm having a problem with JSON on IE 7. I've followed the recommended fixes: referencing Crockford's JSON2.js, setting type and language attributes, etc.
I am still getting a 'JSON' is undefined exception on the IE 9 script console when running in IE 7 standards mode. I am successfully using JSON2.js on the server side in my ASP pages, so this error is just a bit confusing. Based on this post on stackoverflow.com, I am guessing there is some sort of character set/code page issue. I don't have any of the typo's associated with the post. I'll have to play around with charset, language and type attributes to see if I can resolve the issue.
I've tested this on my home network, using IIS 7.5 and 8, along with IE 9 running in IE 7 standards mode and it works fine. This is only happening at work, where I am using IE 9 running in IE 7 standards mode on Windows 7. The servers are Windows 2003 running IIS 6. Fiddler doesn't display anything odd that would indicate the script file is not loading correctly, and the charset/code page is 1252, which is normal.
It seems I need to specify utf-8 in the script file attributes. This does not appear to be a universal requirement, but it got me past the problem at work where IE 7 verification was not working. The final script tag is:
My guess as to why this fixed my issue? JSON2.js contains unicode character definitions as part of it's regex matching/substitutions code. Apparently, IE 7 mode on my work computer needed to be told the file contained unicode characters. Whatever... At least I'm not chewing cycles trying to fix an arcane issue on a minor and very old browser.
Found one more issue with including json2.js for IE 7. If you specify your tag as