Android Question MySql+PHP invisible characters

ilan

Expert
Licensed User
Longtime User
hi

i am using in one of my apps queries that i send to a PHP file and return a JSON string.
the problem is that the string that is returned contains 2 chars at the start that are creating an error.

if i put the copied string to the online JSON Parser tool i get an error:

1636711475831.png


going to the first char and pressing 2 times then the "Delete" button fixes that issue. the thing is that nothing is really deleted so those chars are not letters or numbers. how can i fix that issue?

what i do now is this:

B4X:
Dim jsonStr As String = j.GetString
        Dim parser As JSONParser
        parser.Initialize(jsonStr.SubString2(jsonStr.IndexOf("["),jsonStr.Length))

this works but i wonder why is that happening?

PHP:

PHP:
    case "getbyemail":
        $table = $_GET["mytable"];
        $email = $_GET["email"];
 
        $q = mysqli_query($con, "SELECT * FROM $table WHERE email = '$email'");
        $rows = array();
        while($r = mysqli_fetch_assoc($q))
        {
            $rows[] = $r;
        }
        echo json_encode($rows);
        mysqli_free_result($q);
        break;

thanx
 

ilan

Expert
Licensed User
Longtime User
Make sure the php file is UTF8 encoded. WITH NO BOM!
Post a hexdump of the result you get from PHP-File.

sorry, but i dont understand what this is. :(
where do i set the UTF8 to the php file?

EDIT: (script deleted)
 
Last edited:
Upvote 0
Top