This topic is locked

Concat issue with French characters

6/25/2015 2:27:18 AM
PHPRunner General questions
C
cyberslugg author

Hello,
I am using a custom expression, concat(Code,' - ',Description) to display a combination of the two fields in the Lookup Wizard, display field.
The whole system is regionalized for English and French.
I split the displays in fields by using "language='". $_SESSION["language"] ."'" in the WHERE fields.
Everything works excellent, except for French characters. If I have "English" selected as the Language everything displays and works correctly doing any function.
French does not. in the display I get something like this, "1 - Dipl�me" ... That broken code causes the Edit and Add functions fail... in short they will not display at all. I am guessing it is because those codes are breaking sql in some fashion.
If I only display the Description field everything works perfect... the error only shows up when I have to concatenate the two fields.
Any thoughts or pointers would be great!!
Thanks

HJB 6/25/2015

While HTML "descriptions fields" text is subdue to UTF-8 oriented web browser display, hence giving no problem, "from database injected text" into a web page needs SQL database oriented UTF-8 support as default to work as wished, here to avoid "strange" looking of some typical French characters.
http://stackoverflow.com/questions/202205/how-to-make-mysql-handle-utf-8-properly is giving you more details.

C
cyberslugg author 6/25/2015

Thanks Walk2fly,
So am I correct that I will need to deal with the character set differences on the database side? I didn't see anything that would be a simple change or addition to the custom sql display code that would let me force the character set just for that display. I did dig into things and below is the list of results... Suggestions on the best way to approach? Change the DB coding?
show variables like 'char%';
Variable_name Value

character_set_client utf8

character_set_connection utf8

character_set_database latin1

character_set_filesystem binary

character_set_results utf8

character_set_server latin1

character_set_system utf8

character_sets_dir /usr/share/mysql/charsets/
show variables like 'coll%';
Variable_name Value

collation_connection utf8_general_ci

collation_database latin1_swedish_ci

collation_server latin1_swedish_ci

HJB 6/25/2015

Change the DB coding?

unquote excerpt
Generally, changing the DB (if not by default) to "collation_connection utf8_general_ci" had been working for me.