Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Well known type T status bit 7 #660

Closed
RobChaferDID opened this issue May 7, 2024 · 3 comments · Fixed by #661
Closed

Well known type T status bit 7 #660

RobChaferDID opened this issue May 7, 2024 · 3 comments · Fixed by #661

Comments

@RobChaferDID
Copy link

In https://w3c.github.io/web-nfc/#text-record

Regarding the status byte, it says

"If bit 7 if set, means the payload is encoded in UTF-8, otherwise in UTF-16."

Is this correct? If I set bit 7 and followed by (single byte) Latin letters I get Chinese characters read by my phone (and TagInfo). If I reset bit 7 it reads as Latin characters.

@beaufortfrancois
Copy link
Collaborator

I think you're right, the WebNFC spec should be updated to reflect NFC spec:

image

FYI here's the Chromium code:

        // According to NFCForum-TS-RTD_Text_1.0 specification, section 3.2.1 Syntax.
        // First byte of the payload is status byte, defined in Table 3: Status Byte Encodings.
        // 0-5: lang code length
        // 6  : must be zero
        // 7  : 0 - text is in UTF-8 encoding, 1 - text is in UTF-16 encoding.
        nfcRecord.encoding = (text[0] & (1 << 7)) == 0 ? ENCODING_UTF8 : ENCODING_UTF16;

@beaufortfrancois
Copy link
Collaborator

I've opened #661 to fix this.

@RobChaferDID
Copy link
Author

Excellent, I can stop worrying my writer was wrong :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants