Displaying apostrophes in PHP

Discussion in 'PHP' started by jawinn, Nov 5, 2006.

  1. #1
    I have a PHP page. I just started to add text to the page. When I try to have the text Small Business's I get this:

    Small Business�s

    Any thoughts on how correct this?

    thx,
     
    jawinn, Nov 5, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Look into character encoding for HTML documents.
     
    T0PS3O, Nov 5, 2006 IP
    jawinn likes this.
  3. irunbackwards

    irunbackwards Peon

    Messages:
    791
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if you're echo'ing it, try to escape the character

    echo "Chuck\'s Bar & Grill";
    Code (markup):
    Maybe that should work for ya?
     
    irunbackwards, Nov 5, 2006 IP
  4. jawinn

    jawinn Active Member

    Messages:
    1,024
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    88
    #4
    Wow I kind of snickered when I saw this comment; but that did the trick.
    My encoding was not set correctly.

    Thanks!
     
    jawinn, Nov 5, 2006 IP
  5. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Just to clarify: I'm guessing that you copy and pasted the text from Word or something, right? Those are 'smart' apostrophes and are different from normal apostrophes, hence the problem.
     
    TwistMyArm, Nov 5, 2006 IP
  6. jawinn

    jawinn Active Member

    Messages:
    1,024
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    88
    #6
    No, I was missing this in my header:
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
    Code (markup):
     
    jawinn, Nov 5, 2006 IP