1

Topic: How to have UTF-8 with this script ?

Hello

http://www.le-hiboo.com
> on the right ..."Agenda" ... all my datas are in latin format ... but my page is in UTF-8 format ... my script is

function agenda_gen($type,$nbblock="12"){
global $conn;
if($type){$extsql ="and id_catets =\"$type\"";}
$sql_listeve = "
        SELECT DAYOFMONTH(start)
        AS
            jour, start, event,place,date.valid,title,description,eventtype.type,image,name, town, zipcode, phone, address
        FROM
            place, date, events, eventtype
        WHERE
            start >= NOW()
        AND
            start < (NOW() + INTERVAL 24 DAY) 
        AND
            eventtype.id=events.type
        AND
            date.place=place.id
        AND
            date.event=events.id
        ORDER BY
            start, jour, type, name
    ";

$result_listeve = mysql_query($sql_listeve, $conn);

$NBEVE = mysql_num_rows($result_listeve);

$tour=1;

while(list($jour, $start, $event,$place,$valid,$title,$description,$type,$image_ev,$name, $town, $zipcode, $phone, $address) = mysql_fetch_row($result_listeve))
{
    $tabjour = split(" ", $start);
        $tjour = $tabjour[0];
        $jour = eregi_replace("-","",$tjour);
    if($jour != $cejour)
        {
        if($tour !=1){
            $agenda .="
                        </dl>";

            }


        $agenda .="


                       
                <h3>
                            ".date_zoli($start)."
                </h3>
                       
   
                <dl>
                                <dt>$type</dt>
                    ";
    $tour2++;
                    }else{
                        if($type!="$cetype")
                        {
                            if($tour !=1){$agenda .="</dl>";}
                            $agenda .="

                    <dl>
                                    <dt>$type</dt>
                            ";
                    }
    }

            $agenda .="
           

                                    <dd class=\"nomsoiree\">".stripslashes("$title")."</dd>
                                    <dd class=\"lieu\"><span>".DATETIMEFR($start,3)."</span> $name</dd>
                                    <dd class=\"description\">".stripslashes("$description")."</dd>
                ";
                $tour++;
                $cejour="$jour";
                $cetype="$type";
                if($tour2 == $nbblock){break;}
        }
    $agenda .="
                            </dl>

       
";
return $agenda;
}

?>

WHERE have I to put the function to encode in UTF-8 ?

Thanx smile

Re: How to have UTF-8 with this script ?

If your text dosn't use any extended characters I don't believe you have to 'convert' to utf-8, but if so then these pages might be of interest:
http://php.net/manual/en/ref.mbstring.php
http://php.net/manual/en/ref.iconv.php
http://php.net/manual/en/ref.recode.php

Re: How to have UTF-8 with this script ?

date format has nothing to do w/ text encoding.  if you want it formatted for a different local use the date() function w/ whatever date formatters you want in there.  ifyou want it in a different local (fr or es or ...) use strftime().

after that if you need to encode it utf8 (and its not already utf8 encoded, which I believe http uses by default), then you should encode your output as such.