Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to utilize an xml document but am running into this error:

Invalid byte 3 of 3-byte UTF-8 sequence

My document looks something like this below but with more tags and content. Please do not focus on the document below though. I use several documents with this format. I believe it is a character in my document thats invalid but I just don't know the best way to find it because it is so large.

Any ideas or tools I could use? Thanks.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "file:C:/Documentum/Viewed/map.dtd">
<map xmlns:dctm="" dctm:obj_status="Read-Only" dctm:obj_id="09002af8800af696" dctm:version_label="CURRENT" xmlns:ditaarch="">
    <title>Overview of the Commercial General Liability (CGL) Insurance Coverages  </title><moreTagsHere><!-- more tags here... --></moreTagsHere>
share|improve this question
What application are you using to generate the document? What application are you using to "utilize" the document? – heavyd Aug 21 '09 at 20:47
up vote 1 down vote accepted

There was an invalid curly quote in my xml.

share|improve this answer
me, too. thanks for posting as a possible answer. – Matt Felzani Dec 5 '14 at 18:16

I'd try XMLStarlet:

[...] XMLStarlet is a set of command line utilities (tools) which can be used to transform, query, validate, and edit XML documents and files using simple set of shell commands in similar way it is done for plain text files using UNIX grep, sed, awk, diff, patch, join, etc commands. [...]
[emphasis mine]

share|improve this answer

I have a sneaking suspicion you may be using a tool by Microsoft.

In my experience Expression Web used to place header information in text files to identify them as what ever format they were - nothing else recognized them, and they showed up as random characters. This was particularly an issue with PHP as it broke includes.

share|improve this answer

Forget the fact it's XML, you need to validate the UTF-8. Maybe simply open up in Firefox and search for the � character? Otherwise see UTF-8 validation on Stack Overflow.

share|improve this answer

You've probably used an editor that adds a Byte Order Mark (BOM) to the file. many/most xml editors/website editors allows you to save the document with/without the bom. Check the save options in whatever editor you've been using.

You probably need to remove the BOM to avoid the error.

If your editor doesn't support that option I can recommend the excellent Notepad++

share|improve this answer
I've never seen the UTF-8 BOM forbidden by the XML specs (and surely other BOMs are perfectly fine). In fact, auto-detecting is documented to allow using a BOM, though it's not required as a parser should know how to detect the first <xml? sequence -- – Arjan Aug 22 '09 at 7:53
My bad, updated the post to remove the incorrect information. I have a memory of getting errors on the bom though. Is it the xhtml specs that might disallow it? – Pär Björklund Aug 22 '09 at 9:19
Maybe you had a BOM in some true Unicode String value itself? Or in a database value? Or when transferring over HTTP using Content-Type text/xml then the (authoritative) charset defaults to US-ASCII per, hence a processor should ignore (or maybe even disallow; see a BOM when the charset is not specified. (Using application/xml rather than text/xml solves that default US-ASCII, but of course one should simply specify the charset to start with.) – Arjan Aug 22 '09 at 12:29

If you're using tomcat you proably need to set up the encoding, I am using tomcat as a service in Windows and in the configuration options the following commmand did the trick for me:


Hope it helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.