Skip to main content
machepap
Participating Frequently
Apr 6, 2021 3:13 AM UTC
Question

what is wrong with this line of HTML code?

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 is closed to new replies. Start a new post to keep the conversation going.

    8 replies

    machepap
    machepapAuthor
    Participating Frequently
    Apr 6, 2021 1:35 PM UTC

    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!

     

     

    Translate
    BenPleysier
    Community Expert
    Community Expert
    Apr 6, 2021 2:53 PM UTC

    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

     

    Translate
    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
    Apr 6, 2021 11:44 AM UTC
    • 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

    Translate
    BenPleysier
    Community Expert
    Community Expert
    Apr 6, 2021 12:05 PM UTC

    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>
    Translate
    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
    Apr 6, 2021 12:26 PM UTC

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

    Translate
    BenPleysier
    Community Expert
    Community Expert
    Apr 6, 2021 5:11 AM UTC

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

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