Re: concat and character encoding
Posted by: Franco Zapata
Date: November 20, 2008 07:19AM

I tried using SET NAMES 'utf8';SET collation_connection = 'utf8_general_ci',
because in my db
the vars:
default character set = utf8
default collation = utf8_general_ci

---- THIS IS MY CODE ----------------------

static $connected=FALSE;

if(!$connected){
// data connection from config file
@require(dirname(__FILE__)."/../config.php");

/****** Connect to MySQL ******/
if(!mysql_connect($dbServer, $dbUsername, $dbPassword)){
echo "<div class=\"error\">cant' to connect to server Mysql en '$dbServer'.</div>";
exit;
}
/****** Select DataBase ********/
if(!mysql_select_db($dbDatabase)){
echo "<div class=\"error\">can't connect to database '$dbDatabase'.</div>";
exit;
}
mysql_query ("SET NAMES 'utf8';SET collation_connection = 'utf8_general_ci';"); // using utf8 Unicode character set
$connected=TRUE;
}

------ NOW ---------------
but when I added CAST utf8 in sentences CONCAT:
$combo_ID_employ->Query = "select ID_Consultor, concat(CAST(name_1 AS CHAR CHARACTER SET utf8), ' ', CAST(lastname_1 AS CHAR CHARACTER SET utf8)) from employ order by 2";

I have good results

Thanks a lot Christian!



Edited 1 time(s). Last edit at 11/20/2008 07:20AM by Franco Zapata.

Options: ReplyQuote


Subject
Views
Written By
Posted
19224
November 20, 2006 04:46AM
Re: concat and character encoding
4890
November 20, 2008 07:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.