Jump to content

php jobsite UTF-8 problem


m118

Recommended Posts

hello

 

I use php jobsite software to create a jobsite. There is a problem. The article can not display in the right way.

 

I have change the meta to the UTF-8.

 

This is the links. I have been working on this problem for one week, so far I have not get a solution.  I hope someone know about php jobsite. Thank you very much.

 

http://jobs.enorstar.com/article.php?title=-and-21152-and-25343-and-22823-and-39640-and-26657-and-65306-and-23601--and-19994-and-25351-and-23548-and-20197-and-26381-and-21153-and-2002-6-and-26680-and-24515&article_id=14&auth_sess=e619b48cd50396951e1b8a653e155102&ref=d0c1f49fc9c73798df000c4c9

 

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

This is database connection file.

 

<?php
function bx_db_connect() {
    global $db_link;
    $db_link = @mysql_connect ( DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD );

    if ( $db_link ) {
        if ( ! @mysql_select_db ( DB_DATABASE ) )
            return false;
        return $db_link;
    } else {
      return false;
    }
}
function bx_db_checkconnection() {

    global $db_link;
    $nr_check = 1;
    $res_ping = mysql_ping( $db_link);
    while( !$res_ping && $nr_check < 5) {
        @mysql_close($db_link);
        @bx_db_connect();
        $res_ping = mysql_ping( $db_link) ;
        if(!$res_ping ) {
            sleep(2);
        }
        $nr_check++;
    }
    if(!$res_ping ) {
        return false;
    }else{
        return true;
    }
}
function bx_db_query ( $sql, $execute=true ) {
    global $db_link,$bx_temp_query, $bx_query_time;
    $bx_temp_query=$sql;
    if ($execute) {
          if (function_exists("mysql_ping")){
            bx_db_checkconnection();
          }
          $query_time = microtime();
          $query_start = explode(' ', $query_time);
          $res = @mysql_query ( $sql, $db_link );
          $query_end = explode(' ', microtime());
          $bx_query_time = number_format(($query_end[1] + $query_end[0] - ($query_start[1] + $query_start[0])), 3);
          if (DEBUG_MODE=="yes" && $bx_query_time >1) {
              //write slow query logs:
              $fp = fopen(DIR_SERVER_ROOT."logs/mysql_slow_query", "a");
              fwrite($fp, date('Y-m-d h:i:s')." - Slow query (time: ".$bx_query_time.")\n");
              fwrite($fp, $sql);
              fclose($fp);
          }
          return $res;
    }
    else {
          echo "<br /><span style=\"font-size: 12px; color: #FF0000\">".$sql."</span><br />";
    } 
}
function bx_db_close () {
   global $db_link;
   return @mysql_close ( $db_link );
}
function bx_db_num_rows ( $res ) {
   return @mysql_num_rows ( $res );
}
function bx_db_fetch_array ( $res ) {
    return @mysql_fetch_array ( $res );
}
function bx_db_free_result ( $res ) {
    return @mysql_free_result ( $res );
}
function bx_db_error () {
  global $db_link;
  $ret = @mysql_error ($db_link);
  if ( strlen ( $ret ) ) {
     return $ret;
  }
  else {
    return "Unknown error";
  }
}
function bx_db_fatal_error ( $msg ) {
  echo "<H2>Error</H2>\n";
  echo "<!--begin_error(dbierror)-->\n";
  echo "$msg\n";
  echo "<!--end_error-->\n";
  exit;
}
function bx_db_data_seek($db_query, $row_number) {
    $result = @mysql_data_seek($db_query, $row_number);
    return $result;
}
function bx_db_insert_id() {
    global $db_link;
    $result = @mysql_insert_id($db_link);
    return $result;
}
function bx_db_insert($db_table,$db_fields,$db_values) {
  return bx_db_query("insert into ".$db_table." ($db_fields)"." values ($db_values)");
}
?>

Link to comment
Share on other sites

hello

 

This is a database configuration file for PHP JOBSITE.  I need to edit it .  After I put the mysql_query("SET NAMES 'UTF-8'"); into the program. It is still not working. I do not know why. Please tell me . Thank you very much

 

<?php

function bx_db_connect() {

    global $db_link;

    $db_link = @mysql_connect ( DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD );

 

 

    if ( $db_link ) {

mysql_query("SET NAMES 'UTF-8'");

 

        if ( ! @mysql_select_db ( DB_DATABASE ) )

            return false;

        return $db_link;

    } else {

      return false;

    }

}

function bx_db_checkconnection() {

    global $db_link;

    $nr_check = 1;

    $res_ping = mysql_ping( $db_link);

    while( !$res_ping && $nr_check < 5) {

        @mysql_close($db_link);

        @bx_db_connect();

        $res_ping = mysql_ping( $db_link) ;

        if(!$res_ping ) {

            sleep(2);

        }

        $nr_check++;

    }

    if(!$res_ping ) {

        return false;

    }else{

        return true;

    }

}

function bx_db_query ( $sql, $execute=true ) {

    global $db_link,$bx_temp_query, $bx_query_time;

    $bx_temp_query=$sql;

    if ($execute) {

          if (function_exists("mysql_ping")){

            bx_db_checkconnection();

          }

          $query_time = microtime();

          $query_start = explode(' ', $query_time);

          $res = @mysql_query ( $sql, $db_link );

 

          $query_end = explode(' ', microtime());

          $bx_query_time = number_format(($query_end[1] + $query_end[0] - ($query_start[1] + $query_start[0])), 3);

          if (DEBUG_MODE=="yes" && $bx_query_time >1) {

              //write slow query logs:

              $fp = fopen(DIR_SERVER_ROOT."logs/mysql_slow_query", "a");

              fwrite($fp, date('Y-m-d h:i:s')." - Slow query (time: ".$bx_query_time.")\n");

              fwrite($fp, $sql);

              fclose($fp);

          }

          return $res;

    }

    else {

          echo "<br /><span style=\"font-size: 12px; color: #FF0000\">".$sql."</span><br />";

    } 

}

function bx_db_close () {

  global $db_link;

  return @mysql_close ( $db_link );

}

function bx_db_num_rows ( $res ) {

  return @mysql_num_rows ( $res );

}

function bx_db_fetch_array ( $res ) {

    return @mysql_fetch_array ( $res );

}

function bx_db_free_result ( $res ) {

    return @mysql_free_result ( $res );

}

function bx_db_error () {

  global $db_link;

  $ret = @mysql_error ($db_link);

  if ( strlen ( $ret ) ) {

    return $ret;

  }

  else {

    return "Unknown error";

  }

}

function bx_db_fatal_error ( $msg ) {

  echo "<H2>Error</H2>\n";

  echo "<!--begin_error(dbierror)-->\n";

  echo "$msg\n";

  echo "<!--end_error-->\n";

  exit;

}

function bx_db_data_seek($db_query, $row_number) {

    $result = @mysql_data_seek($db_query, $row_number);

    return $result;

}

function bx_db_insert_id() {

    global $db_link;

    $result = @mysql_insert_id($db_link);

    return $result;

}

function bx_db_insert($db_table,$db_fields,$db_values) {

  return bx_db_query("insert into ".$db_table." ($db_fields)"." values ($db_values)");

}

?>

Link to comment
Share on other sites

on which language you want to show on site. u should specify <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> on the top of the page + use unicode fonts also.if you use arabic language by default it will taken. other wise u should use unicode fonts.

 

second way use font face in css and keep the font on the server and specify the fontname .

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.