php - XML parser error: entity not defined -


I have searched the stackoverflow on this problem and have searched some topics, but I think that actually a solid answer Not for me on this

I have a form that users submit and the value of the field is stored in an XML file. XML is being encoded with UTF-8.

Every now and then a user will copy / paste text from anywhere and then when I do not get "unit defined error".

I realize that XML supports only a few select organizations and nothing is recognized beyond that - hence parser error.

Whatever I collect, there are some options I have seen:

  1. I have all the & amp; Nbsp; I can find and replace & amp; # 32; or swap with real place
  2. I can put the code in question in the CDATA section.
  3. I can include these files in the XML file.

What I am doing with the XML file is that the user can enter the content in a form, it gets stored in an XML file, and that content is sent to the web page (SimplexML With Pars) is displayed as XHtml.

P> / P>

I want to thank everyone for the great response. I have really set what happened because of my unit errors. All suggestions made me look more deeply about this!

Some text boxes where plain old text boxes, but my text was enhanced with TINMMEE, it is being concluded, and closely observing, that PHP alert always refers to data from TinyMCE enhanced textareas. Later on I saw on a PC that all the characters were removed (because they can not read them), but on Mac you can see small class boxes referring to that character's unicode number. The reason shown in sections on Mac in the first place is that I used the UTF 8_AD Code which was not used in UTF to prevent other parsing errors (which is related to TinyMCE in any way).

The solution for all this was quite simple:

I added this line to entity_encoding: "utf-8" in my tinyMCE.init. Now, they look like all the characters they want to see.

I think that I do not understand why the letter kept in the text box is still visible, because nothing changes them into the UTF, but TinyMCE With this it was a problem.

I agree that this is only an encoding problem in PHP, in this way I have solved this problem Before placing the HTML code in the HTML code before the SimpleXMlelement constructor, I would call it html_entity_decode

  • Then utf8_encode () .

  • was encoded using

    The above code does not present any undefined entity error.


    Comments