php utf 8 help

Discussion in 'PHP' started by sunnyverma1984, Apr 28, 2010.

  1. #1
    i want to display all character in my website using utf-8. but i am getting invalid character
    echo "Вопросы и ответы";
    PHP:
    output
    ??????? ? ?????? 
    HTML:
    please help :confused:
     
    sunnyverma1984, Apr 28, 2010 IP
  2. zerophean

    zerophean Peon

    Messages:
    91
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    on your html add this meta :

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
    zerophean, Apr 28, 2010 IP
  3. vinoth.t

    vinoth.t Peon

    Messages:
    156
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Set your content type using header
    header('Content-type: text/html; charset=utf-8');
     
    vinoth.t, Apr 28, 2010 IP
  4. sunnyverma1984

    sunnyverma1984 Well-Known Member

    Messages:
    342
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    120
    #4
    still not working. its a problem with internal php multibyte string (mbstring). i don't know how to configure it.
     
    sunnyverma1984, Apr 28, 2010 IP
  5. vinoth.t

    vinoth.t Peon

    Messages:
    156
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Did you set charset in header
     
    vinoth.t, Apr 28, 2010 IP
  6. sunnyverma1984

    sunnyverma1984 Well-Known Member

    Messages:
    342
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    120
    #6
    i have tried every things but didn't got success :(
     
    sunnyverma1984, Apr 28, 2010 IP
  7. vinoth.t

    vinoth.t Peon

    Messages:
    156
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Its the problem with your php file editor.
    I think you are using Notepad or Wordpad. (Just close the php file and open it you will see the fact)

    Try it using PSPad
     
    Last edited: Apr 28, 2010
    vinoth.t, Apr 28, 2010 IP
  8. nabil_kadimi

    nabil_kadimi Well-Known Member

    Messages:
    1,065
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    195
    #8
    Those 3 should work for you:
    1 - In your text editor make sure that you save the file as utf-8
    2 - use the php header function (make sure it's not overidden in your script or CMS):
    header('Content-type: text/html; charset=utf-8'); 
    PHP:
    3 - Use the http-equive meta tag:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    HTML:
     
    nabil_kadimi, Apr 28, 2010 IP