Skip to main content
machepap
Participating Frequently
April 6, 2021
Question

what is wrong with this line of HTML code?

  • April 6, 2021
  • 3 replies
  • 439 views

Why am I getting a "special character must be escaped error about this line?

<?xml version="1.0" encoding="iso-8859-1"?>

 

thank you! 

    This topic has been closed for replies.

    3 replies

    machepap
    machepapAuthor
    Participating Frequently
    April 6, 2021

    Thanks for all the input. I don't really understand this code, it was generated by dreamweaver when I made this website many years ago. This bit originally was the 2nd line, but the first line also gave an error until I switched the two lines, so now it's:

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?xml version="1.0" encoding="iso-8859-1"?>

     

    I'd like to have error-free code, any further advice is welcome!

     

     

    BenPleysier
    Community Expert
    Community Expert
    April 6, 2021

    Instead of the lines that you have shown, use the following

    <!doctype html>
    <html>
    
    <head>
        <meta charset="UTF-8">
        <title>Untitled Document</title>
    </head>
    
    <body>
    </body>
    
    </html>

    Adjust the `title` to suit.

     

    This may cause other problems, but at least you are using contemporary code.

     

    For more: https://www.w3schools.com/html/html_basic.asp

     

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    B i r n o u
    Legend
    April 6, 2021
    • are you sure that the text file is correctly encoded in 8859-1 ?... by the way do you need 8859-1... utf-8 could be a better choice if you don't have any needs for iso
    • in XML you really need to encode only 5 characters :

     

     

    "   &quot;
    '   &apos;
    <   &lt;
    >   &gt;
    &   &amp;

     

     

    • try removing all white space just before opening the XML tag <?xml

     

    and by the way if you use utf-8... don't use utf-8 bom, I really suspect that your files is UTF-8 BOM encode... and that your first line is copied and pasted from an old document or an example

    BenPleysier
    Community Expert
    Community Expert
    April 6, 2021

    Hi @B i r n o u , I get the impression that the code is being used unside an HTML document. That is why the OP is getting the error.

     

    If he had used it in an XML document, there would be no error.

    <?xml version="1.0" encoding="UTF-8"?>
    <note>
      <to>Tove</to>
      <from>Jani</from>
      <heading>Reminder</heading>
      <body>Don't forget me this weekend!</body>
    </note>
    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    B i r n o u
    Legend
    April 6, 2021

    yes Ben, you're probably right. I agree.

    BenPleysier
    Community Expert
    Community Expert
    April 6, 2021

    If it is used inside an XML document, it should not throw any errors.

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!