m118 Posted February 28, 2012 Share Posted February 28, 2012 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 https://forums.phpfreaks.com/topic/257929-php-jobsite-utf-8-problem/ Share on other sites More sharing options...
MarPlo Posted February 29, 2012 Share Posted February 29, 2012 Hi, Try add php header for utf-8, before output data: if(!headers_sent()) header('Content-type: text/html; charset=utf-8'); Link to comment https://forums.phpfreaks.com/topic/257929-php-jobsite-utf-8-problem/#findComment-1322318 Share on other sites More sharing options...
m118 Posted February 29, 2012 Author Share Posted February 29, 2012 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 https://forums.phpfreaks.com/topic/257929-php-jobsite-utf-8-problem/#findComment-1322406 Share on other sites More sharing options...
Pikachu2000 Posted February 29, 2012 Share Posted February 29, 2012 When posting code, enclose it within the forum's . . . BBCode tags. Stop creating new threads for the same problem. Link to comment https://forums.phpfreaks.com/topic/257929-php-jobsite-utf-8-problem/#findComment-1322423 Share on other sites More sharing options...
Sajesh Mohan Posted March 8, 2012 Share Posted March 8, 2012 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 https://forums.phpfreaks.com/topic/257929-php-jobsite-utf-8-problem/#findComment-1325180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.