Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts

    Thumbs down page wont validate - one or more bytes that validator cannot interpret as utf-8

    for some reason my site wont allow the validator to run because it says

    "Sorry, I am unable to validate this document because on line 609 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.

    The error was: utf8 "\x92" does not map to Unicode "

    i have tried to view the page source and look up line 609 but it doesnt exist?

    so i chacked my php file and there was nothing on line 609 which looked incorrect.

    this is the section of my php page that is apparently causing the problem
    PHP Code:
    $images "<div class='smalldiv'><img src='$image' height='200px;' alt='$shortTitle' title='$shortTitle' /></div>";
            
    $iteminfo "<div class='Desktophot_info_container'>".
            
    "<div class='hot_title'>$shortTitle</div>".
            
    "<div class='hot_description'>$review".
            
    "<div class='buttonsDesktop'>".
            
    "<div class='hot_button1'>".
            
    "<a href='price_results.php?title=$shortTitle&amp;category='".$_SESSION['subpage']."'&amp;info= $artist'><img src='images/compare.gif' alt='compare' title='compare'/></a>".
            
    "</div></div></div></div>"
    anyone have any ideas?

    i can post the full code if needed?

    thanks
    Luke
    Last edited by LJackson; 11-12-2009 at 05:40 PM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Its not there that is the issue. I loaded your HTML source code in Dreamweaver. Line 609 is the part that has the individual product image.
    individual_productImage
    Code:
                <span class="individual_product">
                <span class="individual_productImage">
                <img src="" height="110px" alt="Night At The Museum: Battle Of The Smithsonian
    
    " title="Night At The Museum: Battle Of The Smithsonian
    
    " />
                </span>
                
                <span class="individual_productTitle">
                Night At The Museum: Battle Of The Smithsonian
    
                </span>
    
                </span>
                </a>
    Its complaining about the whitespace you used there. Removing that and revalidating allows it to be validated however there are still errors but they are easy to see what they are.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    I guess it is a problem of how you used the quotes (you have some extra quotes) and added the php variables.
    PHP Code:
    "<a href='price_results.php?title=$shortTitle&amp;category='".$_SESSION['subpage']."'&amp;info= $artist'>" 
    echoes:
    Code:
    <a href='price_results.php?title=Bruno&amp;category='dvd'&amp;info= '>
    I guess you wanted to be:
    Code:
    "<a href='price_results.php?title=$shortTitle&amp;category=".$_SESSION['subpage']."&amp;info=".$artist."'>"
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    hi guys, thanks for the advice,

    @ Aerospace the code you printed is set up in my php like so:
    PHP Code:
    <span class="individual_product">
                <span class="individual_productImage">
                <img src="<?php echo $image ?>" height="110px" alt="<?php echo $shortTitle?>" title="<?php echo $shortTitle?>" />
                </span>
                
                <span class="individual_productTitle">
                <?php print $shortTitle?>
                </span>
                </span>
    but im not sure where the whhite space is?

    @Kor - i tried what you suggested but im still getting the error

    any other ideas or suggestions?

    thanks for your help
    Luke

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The error Kor pointed out will become visible once you get rid of the whitespace. Its coming from the $shortTitle. Remove the echo for $shortTitle and try to revalidate. You may want to use trim() on the $shortTitle.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    ok mate i have added trims to all my $shortTitle and i now have the same error for line 449which in my php file is

    PHP Code:
        line 449 -> $review $row['review'];
            
    line 450 ->$review trim($review); 
    any ideas?

    i will go throught the code again have prob missed something

    thanks
    Luke

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Its not line 449 of your php file because the validator doesn't see that. Its line 449 of your outputted html (view source).
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Anyway, LJackson, first try to see how the HTML code is written by the php (View Source). You will notice the errors easily. Anyway, when generating a HTML document using a server-side language, you should think upside down: first write the HTML code and later write the server-side code line which should generate that HTML code. In other words, try to respect first the HTML (or XHTML - it depends on the used Doctype) rules.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #9
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    hi, ok line 449 of my source code is
    Code:
    <a href="index.php">Home</a> | <a href="contact.php">Contact</a> | <a href="faq.php">FAQ's</a> <br />Copyright Kernow Connect 2008</div>
    but i have this as an include on all my pages and they validate ok?

    sorry for the trouble
    Luke

  • #10
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    No thats not line 449. I'm not sure how you determined that. I loaded your source code again into dreamweaver and line 449 is this
    Code:
                <a href="price_results.php?title=Transformers: Revenge of the Fallen&amp;category=dvd">
                <span class="individual_product">
                <span class="individual_productImage">
                <img src="" height="110px" alt="Transformers: Revenge of the Fallen" title="Transformers: Revenge of the Fallen" />
                </span>
                
                <span class="individual_productTitle">
                Transformers: Revenge of the Fallen            </span>
    
                </span>
    Post the php that generates those details
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #11
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    how did you get that as like 449??? lol i opened url and view source and then went to edit goto line and line 449 was the above???

    anyways...
    this is the code block for that output
    PHP Code:
            <?php
                $itemdata 
    "SELECT * 
                FROM category_data2 
                WHERE cat_id = '"
    .$_SESSION['subpage']."'
                AND subcat_id = 'New Releases'
                ORDER BY id ASC"

                    
                
    $item_query=mysql_query($itemdata)or die(mysql_query);
                
    $num_rows mysql_num_rows($item_query);

                while (
    $row mysql_fetch_array($item_query))
                {
                
                
    $shortTitle htmlspecialchars($row['short_title']);
                
    $shortTitle preg_replace("/.{0}(with Free).*/"""$shortTitle) . "\n";
                
    $shortTitle preg_replace("/.{0}(with Bonus).*/"""$shortTitle) . "\n";
                
    $shortTitle trim($shortTitle);
                
    $artist htmlspecialchars($row['other']);
                
    $image htmlspecialchars($row['image']);
                
    ?>
                
                <a href="price_results.php?title=<?php echo $shortTitle?>&amp;category=<?php echo $_SESSION['subpage']?>">
                <span class="individual_product">
                <span class="individual_productImage">
                <img src="<?php echo $image;?>" height="110px" alt="<?php echo $shortTitle;?>" title="<?php echo $shortTitle?>" />
                </span>
                
                <span class="individual_productTitle">
                <?php print $shortTitle?>
                </span>
                </span>
                </a>
                <?php 
                
    }    ?>
    thanks
    Luke

  • #12
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Once again: you are using incorrectly the quotes in php code and probably add incorrectly some php variables to the strings. For instance, here's an incorrect (X)HTML output:
    Code:
    <a href='price_results.php?title=Formula One Season Review 2009&amp;category=dvd>
    You need a final quote. Or you miss something there. As it is now, you have only the opener one

    And probably there are more errors like the same.
    Last edited by Kor; 11-12-2009 at 05:07 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #13
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    ok found the problem, one of my reviews had a ' in it which was breaking the code

    anyway i added
    PHP Code:
    mysql_query("SET NAMES 'utf8'"); 
    and its now validating the page even though there are errors which at least i can see now lol,

    will crack on with fixing those

    cheers guys...

    may post back if i have any errors i cannot fix
    Luke

  • #14
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,099
    Thanks
    297
    Thanked 12 Times in 12 Posts
    got it sorted now

    thanks guys
    Luke


  •  

    Posting Permissions

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