Skip to content
This repository was archived by the owner on Jun 23, 2024. It is now read-only.
This repository was archived by the owner on Jun 23, 2024. It is now read-only.

iOS text record defaulting to UTF-16 encoding #76

Open

Description

@arrutherford

Hi there,

I've been using nfc_in_flutter on android quite successfully, but when I got around to setting it up on iOS the result wasn't as expected.

I am creating a tag with a single text record, on android it writes as expected (encoding the payload in utf8), however, on iOS it encodes as utf-16.

List records = [
NDEFRecord.text(
payload,
)
];

Has anyone else seen this issue?

Activity

  1. arrutherford commented on Feb 17, 2021

    @arrutherford
    Author

    Ive managed to get it working by altering NfcInFlutterPlugin.m

    altering the if statement at line 391 to the following:
    if ([@"T" isEqualToString:recordType]) {
    payloadData = [[NSString stringWithFormat:@"%c%@%@", recordLanguageCode.length, recordLanguageCode, recordPayload] dataUsingEncoding:NSUTF8StringEncoding];
    tnfValue = NFCTypeNameFormatNFCWellKnown;
    }

    it seems that the "wellKnownTypeTextPayloadWithString" function call in the original code always returned the record as utf16

  2. added a commit that references this issue on Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions