TypeScript: Replacement character (`\uFFFD`) in JavaScript/TypeScript causes to breaks
๐ Search Terms
- TS1490: File appears to be binary
- replacement character
๐ Version & Regression Information
#57008 is incorrect on some real files.
โฏ Playground Link
https://github.com/micromark/micromark/pull/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
About this issue
- Original URL
- State: closed
- Created 3 months ago
- Comments: 19 (8 by maintainers)
Situation:
\ufffdexists because it shouldnโt ever appear in a correctly-encoded file on purposeโWe need to put a raw
\ufffdin a file so we can test itโSituation:
\ufffdexists in a correctly-encoded file on purposehttps://xkcd.com/927/