Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9214567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:59:50+00:00 2026-06-18T01:59:50+00:00

Possible Duplicate: Strange character on Android NDEF record payload I am trying to read

  • 0

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???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:59:51+00:00Added an answer on June 18, 2026 at 1:59 am

    Probably, you have the same problem here and how to read an NFC tag properly here

    Snippet taken from 2nd link.

     try
    {
            byte[] payload = record.getPayload();
    
            /*
         * payload[0] contains the "Status Byte Encodings" field, per the
         * NFC Forum "Text Record Type Definition" section 3.2.1.
         *
         * bit7 is the Text Encoding Field.
         *
         * if (Bit_7 == 0): The text is encoded in UTF-8 if (Bit_7 == 1):
         * The text is encoded in UTF16
         *
         * Bit_6 is reserved for future use and must be set to zero.
         *
         * Bits 5 to 0 are the length of the IANA language code.
         */
    
             //Get the Text Encoding
            String textEncoding = ((payload[0] & 0200) == 0) ? "UTF-8" : "UTF-16";
    
            //Get the Language Code
            int languageCodeLength = payload[0] & 0077;
            String languageCode = new String(payload, 1, languageCodeLength, "US-ASCII");
    
            //Get the Text
            String text = new String(payload, languageCodeLength + 1, payload.length - languageCodeLength - 1, textEncoding);
    
        return new TextRecord(text, languageCode);
    }
    catch(Exception e)
    {
            throw new RuntimeException("Record Parsing Failure!!");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Strange NetworkOnMainThreadException in Android app? Trying To Upload To Dropbox: NetworkOnMainThreadException? I
Possible Duplicate: Large numbers erroneously rounded in Javascript I am experiencing some strange behavior
Possible Duplicate: Android: Strange out of memory issue while loading an image to a
Possible Duplicate: Generate multiple graphics from within an R function Very strange thing happening
Possible Duplicate: AJAX request fails to process $_SESSION variable I have some strange issue
Possible Duplicate: Least Astonishment in Python: The Mutable Default Argument I'm seeing some strange
Possible Duplicate: Is JavaScript's Math broken? Strange result with floating point addition Some simple
Possible Duplicate: How to upload files in JSP/Servlet? I'm having some strange issue with
Possible Duplicate: Java: strange order of queue made from priority queue I tired to
Possible Duplicate: console.log jquery element on chrome look strange Assuming plain jQuery console.log( $('form')

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.