What does the message "Invalid byte 2 of a 3-byte UTF-8 sequence" mean?

A three byte UTF-8 sequence looks like:

1110xxxx 10xxxxxx 10xxxxxx

Your error message may mean that the first byte of the three is incorrectly flagging the start of a three byte sequence or else that the second byte is malformed.

As @avernet says, you need to make sure that all elements in your system are producing and expecting UTF-8.


This happens when Orbeon Forms reads an XML file and expects it to use the UTF-8 encoding, but somehow the file isn't properly encoded in UTF-8. To solve this, make sure that:

  1. You have an XML declaration at the beginning of the file saying the file is in UTF-8:

    <?xml version="1.0" encoding="UTF-8" ?>
    
  2. Your editor is XML-aware, so it can parse the XML declaration and consequently use the UTF-8 encoding. If your editor isn't XML aware, and you don't want to use another editor, look for an option or preference allowing you to specify that the editor must use UTF-8.