Skip to content

Replacement character (\uFFFD) in JavaScript/TypeScript causes to breaks #57930

@wooorm

Description

@wooorm

🔎 Search Terms

  • TS1490: File appears to be binary
  • replacement character

🕗 Version & Regression Information

#57008 is incorrect on some real files.

⏯ Playground Link

micromark/micromark#166

💻 Code

Note the in the first 256 characters.

import assert from 'node:assert/strict'
import test from 'node:test'
import {micromark} from 'micromark'

test('nul', function () {
  assert.equal(
    micromark('asd\0asd'),
    '<p>asd�asd</p>',
    'should replace `\\0` w/ a replacement characters (`�`)'
  )
})

🙁 Actual behavior

error TS1490: File appears to be binary

🙂 Expected behavior

0xFFFD should be fine among other regular characters.

Additional information about the issue

Related-to: #21136.
Related-to: #56516.
Related-to: #57008.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions