The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. Why are apostrophes and other characters still showing as code in my titles?

    Why are apostrophes and other characters still showing as code in my titles?

    Technical SEO Issues
    17 3 11.3k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Function5
      Function5 @Function5 last edited by

      I've done what you've said and this is what I've come up with:

      <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>

      Does anything look odd?

      1 Reply Last reply Reply Quote 0
      • networkelites
        networkelites last edited by

        Hi Gabriel,

        ' Looks like an html entity code for some non-standard apostrophe.  Not sure why though, it looks normal. Your apostrophe might need to be changed to a single quote instead.

        Function5 1 Reply Last reply Reply Quote 0
        • Function5
          Function5 @networkelites last edited by

          Well what would be the html entity code for a standard apostrophe. And even if that is solved, the & is still not displaying correctly.

          I've searched many forums for the answer but nothing seems to be coming up!

          1 Reply Last reply Reply Quote -1
          • blu42media
            blu42media @Function5 last edited by

            This worked for me....

            $site_description = mb_convert_encoding(get_bloginfo( 'description', 'display' ), 'UTF-8', 'HTML-ENTITIES');

            The text is getting encoding in the second half of your meta tag, so if you convert the encoding you should be able to get around this.  You may need to apply this to several sections of that depending on what's going on... check the tag out on several pages.

            Let me know how it works out.

            1 Reply Last reply Reply Quote 0
            • Function5
              Function5 @Function5 last edited by

              Thanks for looking into this. Approximately where would I place this code?

              1 Reply Last reply Reply Quote 0
              • blu42media
                blu42media @Function5 last edited by

                Look in your header.php file.  Here's what the <title>tag code might look like.  Again, you may need to wrap the mb function around more than one piece.  This should get you started.</p> <blockquote style="color: #5e5e5e; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f7f7f7; padding-top: 5px; margin-left: 0px; padding-left: 2px; padding-bottom: 5px; white-space: nowrap; overflow-y: auto; font-family: monospace; background-position: initial initial; background-repeat: initial initial;"> <p><span style="color: #5e5e5e;"><title><?php</span></p> <p><span style="color: #5e5e5e;"> </span><span style="color: #5e5e5e;">/*</span><span style="color: #5e5e5e;"><span> </span>Print the <title> tag based on what is being viewed.</span><span style="color: #5e5e5e;"><span> </span> */</span></p> <p><span style="color: #5e5e5e;"> </span><span style="color: #5e5e5e;">global $page, $paged;</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">wp_title( '|', true, 'right' );</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">// Add the blog name.</span><span style="color: #5e5e5e;"><span> </span>bloginfo( 'name' );</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">// Add the blog description for the home/front page.</span></p> <p><span style="color: #5e5e5e;">$site_description = mb_convert_encoding(get_bloginfo( 'description', 'display' ), 'UTF-8', 'HTML-ENTITIES');</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">if ( $site_description && ( is_home() || is_front_page() ) )</span></p> <p><span style="color: #5e5e5e;"><span style="white-space: pre;"> </span>echo " | $site_description";</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">// Add a page number if necessary:</span></p> <p><span style="color: #5e5e5e;">if ( $paged >= 2 || $page >= 2 )</span></p> <p><span style="color: #5e5e5e;"><span style="white-space: pre;"> </span>echo ' | ' . sprintf( __( 'Page %s', 'oldheidelbergdeli' ), max( $paged, $page ) );</span><span style="color: #5e5e5e;"><br /></span><span style="color: #5e5e5e;"><span> </span></span></p> <p><span style="color: #5e5e5e;">?></title>

                1 Reply Last reply Reply Quote 0
                • Function5
                  Function5 @Function5 last edited by

                  Okay, I found the line:

                  <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>

                  And I tried inserting your code multiple ways but now Fetch as Googlebot is saying the site is unreachable. I've reversed but still get same problem...

                  Strange stuff.

                  1 Reply Last reply Reply Quote 0
                  • blu42media
                    blu42media @Function5 last edited by

                    Gabriel, I think we're close here... give this a try:

                    <title></p> <p><?php wp_title('«', true, 'right'); ?></p> <p><?php echo mb_convert_encoding(get_bloginfo('name', 'display'), 'UTF-8', 'HTML-ENTITIES'); ?></p> <p></title>

                    1 Reply Last reply Reply Quote 0
                    • Function5
                      Function5 @Function5 last edited by

                      Fixed some of the other issues with my site (had a bunch of white spaces in my php files) but this is still not working. I inserted your code and it doesn't break anything, but it doesn't work either from what I can tell...

                      1 Reply Last reply Reply Quote 0
                      • blu42media
                        blu42media @Function5 last edited by

                        Gabriel-

                        Do you have some sort of site caching turned on?

                        1 Reply Last reply Reply Quote 0
                        • Function5
                          Function5 @Function5 last edited by

                          I actually removed site caching because it was causing some problems. But yes, I had it on previously.

                          I'm wondering if the wordpress function - wp_texturize - is doing something funny to the titles...

                          1 Reply Last reply Reply Quote 0
                          • Function5
                            Function5 @Function5 last edited by

                            One more thing - I've noticed that Google, SEOMOZ, and Firefox's View Source all show apostrophes, ampersands, and other characters as code not just in the title tag but also throughout the body of the page - so it is a general problem.

                            1 Reply Last reply Reply Quote 0
                            • blu42media
                              blu42media @Function5 last edited by

                              Gabriel-

                              It's no problem for these codes to appear in other sections of the page.  There are many character sets out there, and what may appear great to you (without codes) looks like gibberish to someone else.  The codes help make for a uniform experience for everyone.  For instance, there are no "smart quote" keys on your keyboard, yet some programs (like Word) will automatically insert these for you.  To have these on a web page most systems will convert these to codes for you.  The ampersand, however, falls into this category since it's often an escape character for other characters.

                              So, the place we're still really most concerned about is the meta title.  I'm not sure why the mb_convert_encoding() function didn't work for you?

                              If you'd like me to take a closer look feel free to message me.  This is solvable - I've done it before on WP sites.

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              • These days on Google results, it also shows the site map. I submitted my company's sitemap and it still does not show?What am I doing wrong?
                                BritneyMuller
                                BritneyMuller
                                0
                                3
                                58

                              • SERP Title shows up-with-dashes
                                BradyDCallahan
                                BradyDCallahan
                                0
                                12
                                314

                              • Screaming Frog showing 503 status code. Why?
                                Angelos_Savvaidis
                                Angelos_Savvaidis
                                0
                                6
                                1.2k

                              • Google showing wrong title
                                MikeRoberts
                                MikeRoberts
                                0
                                9
                                3.1k

                              • Why am I seeing %%name%% showing in the duplicate titles report when it shows the name correctly in the source code?
                                SDConvis
                                SDConvis
                                0
                                3
                                199

                              • Description and Title keyword Not showing in Google SERP?
                                irvingw
                                irvingw
                                0
                                9
                                558

                              • OSE - still showing me links are there when they are not?
                                Cyrus-Shepard
                                Cyrus-Shepard
                                0
                                2
                                425

                              • Why is this url showing as "not crawled" on opensiteexplorer, but still showing up in Google's index?
                                KeriMorgret
                                KeriMorgret
                                0
                                2
                                617

                              Get started with Moz Pro!

                              Unlock the power of advanced SEO tools and data-driven insights.

                              Start my free trial
                              Products
                              • Moz Pro
                              • Moz Local
                              • Moz API
                              • Moz Data
                              • STAT
                              • Product Updates
                              Moz Solutions
                              • SMB Solutions
                              • Agency Solutions
                              • Enterprise Solutions
                              • Digital Marketers
                              Free SEO Tools
                              • Domain Authority Checker
                              • Link Explorer
                              • Keyword Explorer
                              • Competitive Research
                              • Brand Authority Checker
                              • Local Citation Checker
                              • MozBar Extension
                              • MozCast
                              Resources
                              • Blog
                              • SEO Learning Center
                              • Help Hub
                              • Beginner's Guide to SEO
                              • How-to Guides
                              • Moz Academy
                              • API Docs
                              About Moz
                              • About
                              • Team
                              • Careers
                              • Contact
                              Why Moz
                              • Case Studies
                              • Testimonials
                              Get Involved
                              • Become an Affiliate
                              • MozCon
                              • Webinars
                              • Practical Marketer Series
                              • MozPod
                              Connect with us

                              Contact the Help team

                              Moz logo
                              © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                              • Accessibility
                              • Terms of Use
                              • Privacy