Results 1 to 2 of 2

Thread: charset problem in php

  1. #1
    Join Date
    Sep 2008

    charset problem in php

    i'm returning data from database , the charset used in my website is
    HTML Code:
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />

    so everything is displayed well..

    but the problem is when i return data from database which uses charset=tf8-8 is it displayed for me like '????????????????'

    i looked at php manual and i sued this code which returns the data correctly
    PHP Code:
    $connection mysql_connect($DBhost$DBuser);
    mysql_query("set names utf8"$connection); 
    and also at the same time i changed the charset to
    HTML Code:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    it works well but the rest of the page returns


    1- so how to make a specific charset in a part of the page and the rest of the page uses another charset????

    2- the code
    PHP Code:
    $connection mysql_connect($DBhost$DBuser);
    mysql_query("set names utf8"$connection); 
    affect on the rest of the page and returns also
    note that i use another connection and another table

    PHP Code:
    but the line
    mysql_query("set names utf8", $connection);

    [php] make a problem .. how to fix this problems????

  2. #2
    Join Date
    Aug 2004
    I'm not aware of any way to mix character sets on a single web page. If possible, I would try to make everything UTF-8 for maximum flexibility and portability. This article may be of some use if you go that route.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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