www.webdeveloper.com
Results 1 to 2 of 2

Thread: charset problem in php

  1. #1
    Join Date
    Sep 2008
    Posts
    206

    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:
        $ii=mysql_connect($DBhost,$DBuser,$DBpass); 
    but the line
    [php]
    mysql_query("set names utf8", $connection);

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

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,227
    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.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

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



Recent Articles