www.webdeveloper.com
Results 1 to 6 of 6

Thread: HTML 5 Validation: White Space in Path Component

  1. #1
    Join Date
    Apr 2013
    Posts
    23

    HTML 5 Validation: White Space in Path Component

    Hi there,

    I am writing the master page for a web site I am supposed to publish soon, and I am having issues image and video errors. If someone could please help me understand what I am supposed to do, I would appreciate. Here are the errors that I get.

    Code:
        Info Using experimental feature: HTML5 Conformance Checker.
    
        The validator checked your document with an experimental feature: HTML5 Conformance Checker. This feature has been made available for your convenience, but be aware that it may be unreliable, or not perfectly up to date with the latest development of some cutting-edge technologies. If you find any issues with this feature, please report them. Thank you.
    
    ↑ Top
    Validation Output: 6 Errors
    
        Error Line 47, Column 27: Bad value assets/images/kyoto protocol white.jpg for attribute src on element img: Whitespace in path component. Use %20 in place of spaces.
    
              alt="Kyoto Protocol"></div>
    
        Syntax of IRI reference:
            Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20. 
    
        Error Line 49, Column 40: Bad value assets/images/kyoto protocol white resized.jpg for attribute src on element img: Whitespace in path component. Use %20 in place of spaces.
    
              height="210" alt="Kyoto Protocol"></div>
    
        Syntax of IRI reference:
            Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20. 
    
        Error Line 131, Column 20: Duplicate ID box.
    
              <div id="box"> "the average global temperature on Earth has increased by …
    
        ✉
        Warning Line 114, Column 20: The first occurrence of ID box was here.
    
              <div id="box"> "In the centre was also the question of how to relieve the…
    
        ✉
        Error Line 148, Column 78: Bad value assets/videos/1880-2011 temp anomaly.mp4 for attribute src on element source: Whitespace in path component. Use %20 in place of spaces.
    
              <source src="assets/videos/1880-2011 temp anomaly.mp4" type="video/mp4">
    
        Syntax of IRI reference:
            Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20. 
    
        Error Line 149, Column 77: Bad value assets/videos/1880-2011 temp anomaly.mov for attribute src on element source: Whitespace in path component. Use %20 in place of spaces.
    
              <source src="assets/videos/1880-2011 temp anomaly.mov" type="vide/ogg">
    
        Syntax of IRI reference:
            Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20. 
    
        Error Line 150, Column 63: Bad value assets/videos/20 sec 5 year mean 1881-2007.mov for attribute href on element a: Whitespace in path component. Use %20 in place of spaces.
    
        …="assets/videos/20 sec 5 year mean 1881-2007.mov">10 Year MeanAnomaly 1881-2007
    
        Syntax of IRI reference:
            Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20.
    Is there some way that I can fix these issues? Does anyone know how to set spaces to escape 20%? I am actually contemplating getting rid of the images and of the video.

  2. #2
    Join Date
    Mar 2011
    Posts
    1,139
    When a URL contains a whitespace character, you're supposed to encode it with its hexidecimal character code, so a " " should be replaced with "%20". I'm surprised that the validator flagged whitespace characters in the 'alt' attribute for encoding, but the issue is the same. These are generally not serious errors and browsers usually handle them automatically, but you should use the correct format.

    The other error is a potential problem you need to correct. You've used "box" as the value of the 'id' attribute more than once in your document. The 'id' attribute is a means to identify individual elements, so each one needs to be unique. If you need to apply the same CSS setting to more than one element, use the 'class' attribute instead. Good luck!
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Apr 2013
    Posts
    23
    Quote Originally Posted by rtrethewey View Post
    When a URL contains a whitespace character, you're supposed to encode it with its hexidecimal character code, so a " " should be replaced with "%20". I'm surprised that the validator flagged whitespace characters in the 'alt' attribute for encoding, but the issue is the same. These are generally not serious errors and browsers usually handle them automatically, but you should use the correct format.

    The other error is a potential problem you need to correct. You've used "box" as the value of the 'id' attribute more than once in your document. The 'id' attribute is a means to identify individual elements, so each one needs to be unique. If you need to apply the same CSS setting to more than one element, use the 'class' attribute instead. Good luck!
    I more or less understand your point about the "box" id.

    But, excuse if I am not following. How do I include "%20" in my code? You talked about the hexadecimal character code. As far as I know, I am only aware of the hexadecimal color code. If you, please, could give me additional information and instructions on how to correct these errors, I would appreciate.

    Otherwise, I might just to get rid of all my content images.

  4. #4
    Join Date
    Mar 2011
    Posts
    1,139
    You do it by replacing the space characters with '%20', as in:

    alt="Kyoto%20Protocol"
    Rick Trethewey
    Rainbo Design

  5. #5
    Join Date
    Aug 2006
    Posts
    1,909
    I think the validator is only pointing at the file names with spaces in them, not the alt= tags. Replace the ones in the file names first, and see if that solves the %20 issue...

    Dave

  6. #6
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,214
    Also asked and answered here.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles