{"id":90,"date":"2015-07-08T13:03:49","date_gmt":"2015-07-08T17:03:49","guid":{"rendered":"http:\/\/webdev.cedarville.edu\/blog\/?p=90"},"modified":"2018-12-17T12:04:59","modified_gmt":"2018-12-17T17:04:59","slug":"coldfusion-11-and-charset-encoding-issue-serving-images","status":"publish","type":"post","link":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/","title":{"rendered":"ColdFusion 11 and Charset Encoding Issue Serving Images"},"content":{"rendered":"<p>We&#8217;ve long had ColdFusion cfm pages that\u00a0fetch images from a remote server using cfhttp\u00a0or the local file system\u00a0and serve them to the client web browser using a combination of the cfcontent, cfheader and\u00a0cfoutput tags. As we move our production version of ColdFusion from version 9 running on Windows Server 2008 R2\/IIS 7 to version 11 running on Windows Server 2012 R2\/IIS 8.5, this image serving inexplicably broke.<\/p>\n<p>The symptom in the browser was that the image would not show&#8211;it would be the browser&#8217;s broken image icon instead.\u00a0To begin diagnosing the issue, I loaded the cfm script directly that was serving the image. Again, the broken image icon displayed.\u00a0I then began reviewing the http headers to see if anything was amiss.\u00a0Both the request and response headers looked fine. The Content-Type showed &#8220;image\/jpg&#8221; and the Content-Length was sufficiently large. As I dug in and compared the working version and the non-working version, one thing stuck out&#8211;the Content-Type on the non-working version added &#8220;;charset=UTF-8&#8221; to the mime type, whereas the working version omitted the charset completely. Here is a visual of what I am describing:<\/p>\n<p>Working version (CF 9);<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">Content-Type:image\/jpg<\/pre>\n<p>Non-working version (CF 11);<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">Content-Type:image\/jpg;charset=UTF-8<\/pre>\n<p>In addition, comparing the\u00a0file sizes\u00a0being returned by inspecting the &#8220;Size&#8221; column in Chrome&#8217;s Developer Tools view,\u00a0I noticed a dramatic difference. The working version was returning 96.6 KB, while the non-working version was returning a much larger 162 KB.<\/p>\n<p>Since it appeared the the charset setting was the only difference, I tried many thing to either remove it or set it to something else.\u00a0But since the working version was sending it at all, I\u00a0was quite unsure what the charset should be.<\/p>\n<p>After trying many different charsets, including trying to remove it (didn&#8217;t work), and setting the page encoding from ColdFusion, some research finally showed that binary results should have a charset of\u00a0ISO-8859-1. So I changed my cfcontent tag from this:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">&lt;cfcontent type=&quot;image\/jpeg&quot;&gt;<\/pre>\n<p>To this:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">&lt;cfcontent type=&quot;image\/jpeg; charset=ISO-8859-1&quot;&gt;<\/pre>\n<p>As soon as I made this change, the image began appearing!<\/p>\n<p>In summary, it appears that ColdFusion 11 is automatically appending the charset=UTF-8 to the Content-Type header, which is a change from previous versions. To serve up binary data to the web browser, you must override that charset using the cfcontent tag and specifying the ISO-8859-1 charset instead.<\/p>\n","protected":false},"excerpt":{"rendered":"We&#8217;ve long had ColdFusion cfm pages that\u00a0fetch images from a remote server using cfhttp\u00a0or the local file system\u00a0and serve them to the client web browser using a combination of the cfcontent, cfheader and\u00a0cfoutput tags. As we move our production version of ColdFusion from version 9 running on Windows Server 2008 R2\/IIS 7 to version 11&#8230; <a class=\"view-article\" href=\"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/\">View Article<\/a>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6],"tags":[],"class_list":["post-90","post","type-post","status-publish","format-standard","hentry","category-web-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ColdFusion 11 and Charset Encoding Issue Serving Images - Cedarville Web Services<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ColdFusion 11 and Charset Encoding Issue Serving Images - Cedarville Web Services\" \/>\n<meta property=\"og:description\" content=\"We&#8217;ve long had ColdFusion cfm pages that\u00a0fetch images from a remote server using cfhttp\u00a0or the local file system\u00a0and serve them to the client web browser using a combination of the cfcontent, cfheader and\u00a0cfoutput tags. As we move our production version of ColdFusion from version 9 running on Windows Server 2008 R2\/IIS 7 to version 11... View Article\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/\" \/>\n<meta property=\"og:site_name\" content=\"Cedarville Web Services\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-08T17:03:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-12-17T17:04:59+00:00\" \/>\n<meta name=\"author\" content=\"Mark Mazelin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mark Mazelin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/\"},\"author\":{\"name\":\"Mark Mazelin\",\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/#\\\/schema\\\/person\\\/ab92f6846154b230a79d84f494c3f612\"},\"headline\":\"ColdFusion 11 and Charset Encoding Issue Serving Images\",\"datePublished\":\"2015-07-08T17:03:49+00:00\",\"dateModified\":\"2018-12-17T17:04:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/\"},\"wordCount\":389,\"commentCount\":0,\"articleSection\":[\"Web Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/\",\"url\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/\",\"name\":\"ColdFusion 11 and Charset Encoding Issue Serving Images - Cedarville Web Services\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/#website\"},\"datePublished\":\"2015-07-08T17:03:49+00:00\",\"dateModified\":\"2018-12-17T17:04:59+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/#\\\/schema\\\/person\\\/ab92f6846154b230a79d84f494c3f612\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/2015\\\/coldfusion-11-and-charset-encoding-issue-serving-images\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ColdFusion 11 and Charset Encoding Issue Serving Images\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/\",\"name\":\"Cedarville Web Services\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/#\\\/schema\\\/person\\\/ab92f6846154b230a79d84f494c3f612\",\"name\":\"Mark Mazelin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/231c381197161fbfc60fca16cb5d0ac8917729e344461b6be5ef3244c1e806a8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/231c381197161fbfc60fca16cb5d0ac8917729e344461b6be5ef3244c1e806a8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/231c381197161fbfc60fca16cb5d0ac8917729e344461b6be5ef3244c1e806a8?s=96&d=mm&r=g\",\"caption\":\"Mark Mazelin\"},\"url\":\"https:\\\/\\\/webdev.cedarville.edu\\\/blog\\\/author\\\/markmazelin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ColdFusion 11 and Charset Encoding Issue Serving Images - Cedarville Web Services","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/","og_locale":"en_US","og_type":"article","og_title":"ColdFusion 11 and Charset Encoding Issue Serving Images - Cedarville Web Services","og_description":"We&#8217;ve long had ColdFusion cfm pages that\u00a0fetch images from a remote server using cfhttp\u00a0or the local file system\u00a0and serve them to the client web browser using a combination of the cfcontent, cfheader and\u00a0cfoutput tags. As we move our production version of ColdFusion from version 9 running on Windows Server 2008 R2\/IIS 7 to version 11... View Article","og_url":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/","og_site_name":"Cedarville Web Services","article_published_time":"2015-07-08T17:03:49+00:00","article_modified_time":"2018-12-17T17:04:59+00:00","author":"Mark Mazelin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mark Mazelin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/#article","isPartOf":{"@id":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/"},"author":{"name":"Mark Mazelin","@id":"https:\/\/webdev.cedarville.edu\/blog\/#\/schema\/person\/ab92f6846154b230a79d84f494c3f612"},"headline":"ColdFusion 11 and Charset Encoding Issue Serving Images","datePublished":"2015-07-08T17:03:49+00:00","dateModified":"2018-12-17T17:04:59+00:00","mainEntityOfPage":{"@id":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/"},"wordCount":389,"commentCount":0,"articleSection":["Web Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/","url":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/","name":"ColdFusion 11 and Charset Encoding Issue Serving Images - Cedarville Web Services","isPartOf":{"@id":"https:\/\/webdev.cedarville.edu\/blog\/#website"},"datePublished":"2015-07-08T17:03:49+00:00","dateModified":"2018-12-17T17:04:59+00:00","author":{"@id":"https:\/\/webdev.cedarville.edu\/blog\/#\/schema\/person\/ab92f6846154b230a79d84f494c3f612"},"breadcrumb":{"@id":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webdev.cedarville.edu\/blog\/2015\/coldfusion-11-and-charset-encoding-issue-serving-images\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webdev.cedarville.edu\/blog\/"},{"@type":"ListItem","position":2,"name":"ColdFusion 11 and Charset Encoding Issue Serving Images"}]},{"@type":"WebSite","@id":"https:\/\/webdev.cedarville.edu\/blog\/#website","url":"https:\/\/webdev.cedarville.edu\/blog\/","name":"Cedarville Web Services","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webdev.cedarville.edu\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/webdev.cedarville.edu\/blog\/#\/schema\/person\/ab92f6846154b230a79d84f494c3f612","name":"Mark Mazelin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/231c381197161fbfc60fca16cb5d0ac8917729e344461b6be5ef3244c1e806a8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/231c381197161fbfc60fca16cb5d0ac8917729e344461b6be5ef3244c1e806a8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/231c381197161fbfc60fca16cb5d0ac8917729e344461b6be5ef3244c1e806a8?s=96&d=mm&r=g","caption":"Mark Mazelin"},"url":"https:\/\/webdev.cedarville.edu\/blog\/author\/markmazelin\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/posts\/90","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/comments?post=90"}],"version-history":[{"count":1,"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/posts\/90\/revisions"}],"predecessor-version":[{"id":91,"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/posts\/90\/revisions\/91"}],"wp:attachment":[{"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/media?parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/categories?post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webdev.cedarville.edu\/blog\/wp-json\/wp\/v2\/tags?post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}