Possible Duplicate:
Strange character on Android NDEF record payload
I am trying to read some plain text from NFC tag. and my codes are below;
public void processReadIntent(Intent intent){
Parcelable[] rawMsgs = intent.getParcelableArrayExtra(
NfcAdapter.EXTRA_NDEF_MESSAGES);
NdefMessage msg = (NdefMessage) rawMsgs[0];
// record 0 contains the MIME type, record 1 is the AAR, if present
Log.d("msg", msg.getRecords()[0].getPayload().toString());
String PatientId=new String(msg.getRecords()[0].getPayload());
String UserName="nurse";
String Password="nurse";
Toast.makeText(getApplicationContext(), PatientId, Toast.LENGTH_LONG).show();
//tv.setText(new String(msg.getRecords()[0].getPayload()));
}
BUT, the problem here is when i read data i can see that my desired data has a ‘en’ at the start.
for example: if my actual data in ‘john’, when i read, i can see it as ‘enjohn’.
I know ‘en’ is the language header. But how do I remove it??
i have tried with substring, but after that don’t even work…
any idea about how to remove this language header???
Probably, you have the same problem here and how to read an NFC tag properly here
Snippet taken from 2nd link.