SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru ripcurlksm's Avatar
    Join Date
    Aug 2004
    Location
    San Clemente, CA
    Posts
    857
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Weird Characters <?> and

    I am working on re-launching a website, and I am having some data display issues that Im not sure if its CSS problems, general UTF character issues or other.
    --------------------------------------------------------------------------
    Here is what the live site looks like (good):
    --------------------------------------------------------------------------


    --------------------------------------------------------------------------
    Here is what my new site looks like, with identical data (bad):
    --------------------------------------------------------------------------

    --------------------------------------------------------------------------


    Here is what the data looks like
    PHP Code:
    <class="MsoNormal" ><b><span><o:p> </o:p></span></b></p>                 <class="MsoNormal" style="margin-left: 0.25in; text-indent: -0.25in;"><span>i.<span>                       </span>Types of Heart Valve Disorders<o:p></o:p></span></p>                 <class="MsoNormal" style="text-indent: 0.25in;"><span>aValvular Stenosis<o:p></o:p></span></p>                 <class="MsoNormal" style="text-indent: 0.25in;"><span>bValvular Regurgitation<o:p></o:p></span></p>                 <class="MsoNormal" style="text-indent: 0.25in;"><span>cValve Prolapse<o:p></o:p></span></p>                 <class="MsoNormal" style="margin-left: 0.25in; text-indent: -0.25in;"><span>ii.<span>                       </span>Heart Valve Disorder Treatment Strategies<o:p></o:p></span></p>                 <class="MsoNormal" style="margin-left: 0.25in; text-indent: -0.25in;"><span>iii.<span>   </span>Heart Valve Repairs and ReplacementsCombined Procedure Volumes                    Forecast<o:p></o:p></span></p>                 <class="MsoNormal" style="text-indent: 0.25in;"><span>aAnnuloplasty Device Implantations<o:p></o:p></span></p>                 <class="MsoNormal" style="text-indent: 0.25in;"><span>bMechanical Heart Valve Implantations<o:p></o:p></span></p>                 <class="MsoNormal" style="text-indent: 0.25in;"><span>cTissue Valve Implantations<o:p></o:p></span></p

    What would make it display differently in one instance, and different in another with the same data??
    Attached Images Attached Images

  2. #2
    SitePoint Addict mixmastermidori's Avatar
    Join Date
    Sep 2001
    Posts
    337
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you copy and paste the text from somewhere? If so, try deleting the space between those outline numbers and the text and adding new spaces. I don't know if that makes sense, but it works for me when I see those funny marks.
    Nature's Sunshine herbs and supplements

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The character encoding you declare doesn't match the encoding you've used in your document.
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Guru ripcurlksm's Avatar
    Join Date
    Aug 2004
    Location
    San Clemente, CA
    Posts
    857
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @autistic -- I am currently using UTF-8, and I've tried switching my header to Latin, ISO, and its still outputting the same. What encoding should I use? Here is my current header:

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
    <
    html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <
    head>
    <
    meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    @mixmaster -- yes the text was copied from a client, I would edit everything, but there are literally thousands of these instances. Im a little puzzled because this is working on my current site, no weird characters... but now on my new demo site i guess my character encoding is wrong.

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ripcurlksm View Post
    What encoding should I use?
    The important thing is that the encoding you use matches the encoding you declare. Otherwise browsers will misinterpret the ones and zeroes and show the wrong characters.

    I generally recommend UTF-8 if at all possible, since that allows you to literally represent any ISO/IEC 10646 character. If you use a more restricted encoding, like ISO 8859-1, you'll have to use entity references or numeric character references to represent characters that aren't can't be represented literally (like dashes, curly quotes, ellipses, non-Latin characters, etc.)

    Quote Originally Posted by ripcurlksm View Post
    Here is my current header:
    The header is meaningless if your web server declares the encoding in the Content-Type HTTP header (which is very common).

    Assuming your server also declares the encoding as UTF-8, you must make sure that every character in your document is encoded as UTF-8.

    The code fragments you posted indicate that you've written the document in something like MS Word and saved as HTML. As far as I know, Word doesn't use UTF-8 by default, but a Microsoft-specific encoding (Windows-1252).

    That would explain the question marks in the black diamonds, since Windows-1252 characters with a code position greater than 127 will be invalid characters when interpreted as UTF-8 (which uses two octets to represent those characters).
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

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