Android Question Charachter set from db

tufanv

Expert
Licensed User
Longtime User
Hello,

I am adding some list from remote database to listview. Because some charachters include ö , ç , ğ (Turkish Lang. Charachters) it does not display correctly in the spinner list. How can i fix it ?

TY
 
Hi Tufany maybe you wrong a few steps :) I try this in very language and work without problem ( also in Turkish ;) )

Is important this steps:

1. When you create table in Mysql create with Character Set Utf8 AND Collation utf8_general_ci. In different case ( example you create table latin, etc. ) dont work .

2. Add in your file php this line:

Code: Copy
......
$conn_DB=mysql_connect($hst,$usr,$pwd) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());

//*** THIS IS VERY IMPORTANT
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES 'utf8'");
mysql_query("SET COLLATION_CONNECTION = 'utf8_unicode_ci'");
//****

$query = file_get_contents("php://input");
......

In this example that i put here i work with Italian (latin.. ), Turkish, Chinese, Hungarian ( of course i utilize also spinner ;) )

THIS IS CODE B4A, MYSQL, PHP:


THIS IS APP WORKING WITH ALL CHARACTERS



Bye Bye and good work with B4A
 
Upvote 0
All right the problem was because of the data imported in. there is no problem with db settings . They are all as you said.
But the csv file i used to import data to db includes different charachters . for example
instead of Esenboğa International > Esenboğa International . is there any way to fix this in the csv file ?
 
Last edited:
Upvote 0
Back
Top