illegal characters in XML using UTF-8

What are the
illegal characters in XML using UTF-8
ecandel420Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ecandel420Author Commented:
Aside from &,",',Carriage Return, Line Feed, < and >

Entity      Entity Reference      Hex      Description      Value
amp      &amp;        26            ampersand (&)      U+0026
lt      &lt;            3C      less-than (<)                           U+003C
apos      &apos;        27      apostrophe (')      U+0027
quot      &quot;       22      double quote (")       U+0022
gt      &gt;         3E                      greater-than (>)      U+003E
¿                   OA                         Carriage return (¿)      
¿                   OD                          Line Feed  (¿)      
0
BigRatCommented:
Converting the UTF-8 into Unicode, then the illegal Unicode character positions are documented at
http://www.w3.org/TR/2006/REC-xml11-20060816/#charsets

Simply put anything under hex 20 other than CR LF and TAB is illegal, then from hex 80 to 9F except 85 also and then various "gaps" between the "code pages".

But UTF-8 is an encoding of Unicode whereby the Unicode positions are encoded in 1 to 6 bytes. The start byte determines how many other bytes follow and these bytes must be in specific ranges in order to tell if one byte is out of sequence. See http://en.wikipedia.org/wiki/UTF-8#Invalid_byte_sequences.

If you want to check a UTF-8 string for complete consistancy with the standards you'll need to implement a UTF-8 to Unicode converter and the test each Unicode character against the standard (say in a bit map) which you can download from www.unicode.org.

HTH
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
This article can shed some light on the issues that we frequently encounter.
http://www.joelonsoftware.com/articles/Unicode.html

A lot of times people seem to thing Unicode (UTF-8) is needed when it really is not needed.  Example: You are producing XML with Western European characters, but not Chinese or Korean.  In that case you can use ISO8859-1 and things should work out fine.

What programming languages are you using?  If you use PHP I can give you code examples showing some ways of getting past the problem.  One strategy, no matter what language you use, is to replace the illegal unicode characters with numbered entities like &#0A; etc...
0
EE_AutoDeleterCommented:
I've requested that this question be deleted for the following reason:

                           
No comment has been added to this question in more than 21 days, so it is now classified as abandoned and is now flagged for deletion.


If there is a valid solution, please OBJECT and indicate the comments that are, or would otherwise lead to, a solution.


Use the specific format https:#axxxxxxxx for comment ID(s).


Also, please don't object simply because the author did not respond to your comment. While we understand this is frustrating, unfortunately we cannot force the author to return to the question. Unless you feel you have presented a valid, verifiable solution we'll simply delete the question.


Experts-Exchange Auto Deleter
0
Ray PaseurCommented:
Wow, since this is like five years old, the state of the art has advanced a bit.  I think BigRat gives a good answer here.  Also, numbered entities have always worked with XML.  And since the long-ago time of this question, I've written an article on UTF-8 and its role in character set encoding.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11880-Unicode-PHP-and-Character-Collisions.html
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.