{"id":492,"date":"2025-11-07T04:27:12","date_gmt":"2025-11-07T09:27:12","guid":{"rendered":"http:\/\/wfredk.com\/blog\/?p=492"},"modified":"2025-11-07T04:27:12","modified_gmt":"2025-11-07T09:27:12","slug":"i-was-discussing-utf-8-encoding-with-chatgpt","status":"publish","type":"post","link":"https:\/\/wfredk.com\/blog\/2025110704\/i-was-discussing-utf-8-encoding-with-chatgpt","title":{"rendered":"I was discussing UTF-8 encoding with ChatGPT&#8230;"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Me:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>I know that <code>BOM<\/code> in this context means &#8220;Byte Order Mark&#8221; but in my experience, it has also (perhaps more often) meant &#8220;Bill Of Materials&#8221; which is where part of my initial confusion came from when I first encountered <code>UTF-8 BOM<\/code> (in an <em>extremely<\/em> negative way &#8211; it cost me at least 8 hours trying to find a PHP bug that I had no clue about) &#8211; and if you ask me, it&#8217;s missing a <code>B<\/code> at the end:  The encoding format should be named <code>UTF-8 BOMB<\/code> because it blows up anywhere but in tiny parts of the evil micro$hit universe.<\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">ChatGPT:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>laughing<\/em> \u2014 yes, <strong>UTF-8 BOMB<\/strong> is a completely fair name for it.<\/p><p>That \u201cinvisible\u201d 3-byte gremlin \u2014 <code>EF BB BF<\/code> \u2014 has ruined more otherwise-perfect PHP, Bash, and Python files than just about anything else that\u2019s technically legal. I\u2019ve seen it sneak in via Notepad, Notepad++, even some FTP clients doing \u201cauto-convert.\u201d The interpreter hits those bytes before <code>&lt;?php<\/code> or <code>#!\/usr\/bin\/env bash<\/code>, and suddenly nothing works, sometimes with <em>no error at all<\/em> until hours later.<\/p><p>So yes: in web and UNIX land, the only correct number of BOMs is <strong>zero<\/strong>.<\/p><p>It\u2019s funny how the same acronym went from \u201cBill of Materials\u201d (useful list of parts) to \u201cByte Order Mark\u201d (useless source of pain).<\/p><p>Your instinct to avoid it everywhere outside the \u201ctiny parts of the evil micro$hit universe\u201d is absolutely right. UTF-8 without BOM is what every real operating system expects, and it\u2019ll keep your toolchain predictable\u2014no hidden payloads waiting to explode.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Me: I know that BOM in this context means &#8220;Byte Order Mark&#8221; but in my experience, it has also (perhaps more often) meant &#8220;Bill Of Materials&#8221; which is where part of my initial confusion came from when I first encountered UTF-8 BOM (in an extremely negative way &#8211; it cost me at least 8 hours [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,28],"tags":[],"class_list":["post-492","post","type-post","status-publish","format-standard","hentry","category-hilarious","category-software-development"],"_links":{"self":[{"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/posts\/492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/comments?post=492"}],"version-history":[{"count":1,"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/posts\/492\/revisions"}],"predecessor-version":[{"id":493,"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/posts\/492\/revisions\/493"}],"wp:attachment":[{"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/media?parent=492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/categories?post=492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wfredk.com\/blog\/wp-json\/wp\/v2\/tags?post=492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}