I just came across one problem, that when I am reading php from my server to android applicaiton, instead of ouput "šinko" there is ouput "Å¡inko". But when I am calling "hhttp.website/data.php"(name of php) I get correct output. but when reading it from my android application there is some kind of a mess... Do you have any idea what should I do? My java code;
public class Admin extends AppCompatActivity {
private TextView test;
String text;
List<String> list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin);
test = (TextView) findViewById(R.id.test);
BackgroundWorker backgroundWorker = new BackgroundWorker(this);
String type = "data";
try {
text = backgroundWorker.execute(type).get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
list = new ArrayList<>(Arrays.asList(text.split("/")));
for(String x : list){
System.out.println(x);
}
}
}
<?php
require "conn.php";
$mysql_query = "SELECT
Name,
Surname,
Name_of_fee,
sum(Cost) as dept
FROM Person
JOIN Relation ON Person.ID = Relation.Person_ID
JOIN Fee ON Fee.ID = Relation.Fee_ID
GROUP BY Person.ID;";
$result = mysqli_query($conn, $mysql_query);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "". $row["Name"]." " . $row["Surname"]. " " . $row["dept"]."<br>" ;
}
} else {
echo "0 results";
}
?>