Identical strings in PHP and Java are not equal -
i'm experiencing strange problem, when send string php java (android).
the whole story rather simple: java application sends keyword php script. php script looks in db , sends json encoded array (as string) java application.
i can see string in textview field in android , looks this: [{"name":"berlin"}]
but java not accept valid json string (unlike online json validators), because keeps throwing exception: "a jsonarray text must start '[' @ character 1". when compare strings identical string hardcoded in java using "equal()" turns out, aren't equal. , more disturbing: java returns length of json string 20, not 19.
why be? there no unusual characters umlauts. 20th character? i'm suspecting encoding problem, i'm pretty sure (php file, java file) utf-8 encoded.
(before asks: can provide code, don't know part relevant.)
try
int ascii_code = jsonstring.codepointat(0)
and see get
Comments
Post a Comment