Android Question other language Fonts

elitevenkat

Active Member
Licensed User
Longtime User
hi
B4X:
lbl.text= "தமிழ் மொழி"

this code displays the text correctly in the device.

i store the string "தமிழ் மொழி" stored in mysql database table to a sqlite table stored locally in the device using httpjob...

i read the sqlite table using dbuttils.

when i try the following

B4X:
lbl.text=(value retrieved from the sqlite table   )

it is displayed as "?????? ?????"

i had viewed the sqlite table using SQLiteViewer utility, the field value is stored/displayed as "?????? ????" in the table

is any conversion process is required at the time of storing in sqllite table ? i read the default utf8 coding is used by sqlite.

can someone help ?
 

Sanxion

Active Member
Licensed User
Longtime User
hi
B4X:
lbl.text= "தமிழ் மொழி"

this code displays the text correctly in the device.

i store the string "தமிழ் மொழி" stored in mysql database table to a sqlite table stored locally in the device using httpjob...

i read the sqlite table using dbuttils.

when i try the following

B4X:
lbl.text=(value retrieved from the sqlite table   )

it is displayed as "?????? ?????"

i had viewed the sqlite table using SQLiteViewer utility, the field value is stored/displayed as "?????? ????" in the table

is any conversion process is required at the time of storing in sqllite table ? i read the default utf8 coding is used by sqlite.

can someone help ?

Excuse my ignorance but what language is this?

I ask because I have no problem storing Arabic in SQLite.
 
Upvote 0

elitevenkat

Active Member
Licensed User
Longtime User
The problem is most probably in MySQL encoding. Make sure that it uses UTF8.

Try to insert the text directly to the SQLite database and see whether it is stored correctly or not.
i checked. attached image file showing mysql table data and the json returned data.
 

Attachments

  • mysqllist.jpg
    mysqllist.jpg
    221.2 KB · Views: 240
Upvote 0

ArminKH

Well-Known Member
if the problem is in php side then open php file by notepad and SaveAs it as Utf8
 

Attachments

  • upload_2016-2-14_12-45-0.png
    upload_2016-2-14_12-45-0.png
    33.1 KB · Views: 227
Upvote 0

elitevenkat

Active Member
Licensed User
Longtime User
@Erel
i am encoding in utf8 in the php script.
B4X:
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json; charset=UTF-8');

echo utf8_encode(json_encode($output));

changing to RDC is a good idea. unfortunately i have been using php scripting for all my projects and the back end app is done purely on php.
can you guide me. i am struck.

@ArminKH

Thanks for your reply. I saved as suggested by you but the results are no different
 
Upvote 0

elitevenkat

Active Member
Licensed User
Longtime User
Add this line to your PHP script: mysql_query("SET CHARACTER SET utf8");

mysql_query function is deprecated.

for php 5.4> to set character set i changed to $conn->set_charset("utf8"); where $conn is mysqli connection.

with that line included, my issue is solved. Now the characters "தமிழ் மொழி" display correctly.

Thanks for the help Erel
 
Upvote 0
Top