JSONã¨JSONPã®Content-typeã«æ¸ãMIMEã¿ã¤ã
ãã¡ã¤ã« | æ£ããMIMEã¿ã¤ã | RFC | IEç¨ |
json | application/json | http://www.ietf.org/rfc/rfc4627.txt | RFCéã |
jsonp | application/javascript | http://www.ietf.org/rfc/rfc4329.txt | text/javascript |
JSONã®å ´åã¯application/json
ã ãã©ãJSONPã£ã¦å®ä½ã¯ã³ã¼ã«ããã¯é¢æ°ã§JSONãå
ãã åãªãJavaScriptãªã®ã§ãMIMEã¿ã¤ãã¯JavaScriptã¨åãã§ããJavaScriptã®MIMEã¿ã¤ãã¯ã以åã¯text/javascript
ã ã£ããã©ã2006å¹´4æã«RFC4329ãåºã¦application/javascript
ã«ãªã£ããã ã¨ãã
IEã£ã¦ä½¿ããªã
Internet Explorer 7 ã§ã¯ application/(java|ecma)script ã®ã»ãã¯ã¨ã©ã¼ã«ãªãã
JavaScript ソースの MIME タイプ - odz buffer
éä¸ããå¤ãã£ãããã ãããIE7ã¯application/json
ã ã¨ã¨ã©ã¼ã«ãªã£ã¦ãã¾ããã§ãããちょっとしたメモ - Not Foundã§IE8ã§ã©ããªãã試ããã¨ããããã£ã±ãã¨ã©ã¼ã«ãªãã¾ãããã»ãã¨IEã£ã¦ä½¿ããªãã
詳ããã¯æ¸ããªããã©å®éã«HTTP Headerã«æ¸ãã¨ãã¯
Safariã§ãã«ããã¤ããªæåãå«ãå ´åã¯ããcharset=utf-8ãããã£ãã»ããããã§ãã
Opera(8.5)ã¯text/javascriptã ã¨æ ¹æ¬çã«ã ãã¿ããã§ãã
Catalyst::View::JSONã¯ãtext/javascript+jsonãã¨ããªã£ã¦ãããã ãã©ã©ãããã®ãè¯ãã®ã§ãããããã£ãã¾ã§ãééãã¦ãutf8ãã£ã¦æ¸ãã¦ãã¾ã£ã¦ãããã ãã©ãIE以å¤ã¯ãã¾ãèªèãã¦ããã¾ããã
JSONとContent-Type : blog.nomadscafe.jp
JSONã«text/javascript
ã使ã£ã¦ããã¨ãçµæ§å¤ãè¨äºãªã®ã§ä»ã¯ã©ããªã£ã¦ãã®ãåãããªããã©ãHTTPãããã¼ã®Content-typeã®æ¸ãæ¹ã§èªãããèªããªãã£ããã¨ããã®ã¯ããã£ã±ããã£ãã¿ããã§ããããè¨ãã®è¦ãã¨ãapplication/json
ã¯IE6ã¨ãIE7ã§ã¡ããã¨èªããã®ãã¨ãæ°ã«ãªã£ã¦ãã¾ãããIE6ã¯ãã対å¿ããããªãã®ã§ãã¨ããããä»ã¯èª¿ã¹ãªããã©ã
charset: UTF-8
ãè¦ããè¦ããªããã«ã¤ãã¦ãã調ã¹ã¦ãªãã®ã§æå®çãªãã¨ã¯æ¸ãã¾ãããã¨ãããã以å調ã¹ããã ãã©ãæ¥ãã§ãã®ã§ã¾ã¨ããã«å¿ãã¡ãã£ã¦ã¾ãã確ããã®ã¨ãã®çµè«ã¯ããã«ããã¤ãã¨ãå
¥ã£ã¦ã¦ãUnicodeã§ã¨ã³ã³ã¼ã*1ããã¦ãJSONèªä½ã¯ASCIIã®ç¯å²å
ã§è¡¨è¨ããã¦ãã¨ããäºã§ãcharset: UTF-8
ã¯è¦ããªãããããªããã¨æãã¾ãããphpã§JSONãçæãããã©json_encode()
ã¯UTF-8ãªæååããã¡ããã¨JSONã«ãã¦ããã¾ãããJSONããã¼ã¹ãã¦è¡¨ç¤ºããããããhtmlã¯EUC-JPãªã®ã§å¤§ä¸å¤«ããªã¨ããçåã ã£ããã§ãããä½ãæ°ã«ãã表示ã§ãã¾ããã