Coldfusion and invalid XML character

Coldfusion and invalid XML character

Today I had a “banging my head to the wall” time where I was confronted with this pesky error:

“An invalid XML character (Unicode: 0x0) was found in the element content of the document.”

Point is that I already created the file in Coldfusion and also used xmlformat for adding the content. So it was “impossible” that there was an error in the content of the XML file. After looking around (yes, Bing or Google is sometimes really your friend) I read that the problem should be some character encoding issue. Since, I already used UTF-8 for writing and reading the file, I thought I had it covered.

Well, to spare you from reading any longer (after all you just came here for the solution ,right?) I figured that I had to escape the control chars before using xmlparse(). In other words, a simple rereplace() was the solution:


Trusted by over 2,000 organizations with millions of emails

Helpmonks helps us answer customer emails at lighting speed
We couldn't do our job without Helpmonks!
Helpmonks, the best thing since sliced bread
Excellent option for collaborating email amongst your team
A good platform that is here to grow and help you grow
Helpmonks is a great tool that our company utilizes and depends on
Great shared inbox for the team
Fantastic email support service for any business
Easy to navigate and catalog data for specific users
Solid Helpdesk software w/ responsive customer support
A really good solution to manage customer support mailbox
Good support, useful features

One more thing...

Helpmonks gives you the ability tocollaborate as a groupin your shared mailbox, features aTeam To-Do App, powerfulCustomer Relationship Management (CRM)capabilities, a completeLive-Chat tool, a mighty Email Marketing Platform that includes sending ofemail campaignsandemail automation, collision detection, email tracking, reminders, mentions, custom fields, custom applications, customer satisfaction ratings, Single-Sign-On (SSO) & SAML authentication, Trello, Zapier, Slack, an API, and much more.

Check outthe complete feature listor sign up for afree 30-day shared inbox trial now