Skip to content

Ktfmt should ignore the UTF-8 BOM. #565

@vRallev

Description

@vRallev

In our codebase we had one Kotlin file, which first three bytes were the UTF-8 BOM 0xEF 0xBB 0xBF. Most tools ignore these three bytes, but ktfmt didn't and reported an error:

TestWithBom.kt:1:1: error: Expecting an element

It took a while to figure out what's wrong with the file, because the syntax is correct and most editors don't highlight these bytes. It's clear to me, that the UTF-8 BOM is redundant and we removed it, but it would be better, if ktfmt would ignore the BOM by default.

I attached a .zip file that contains two .kt files to reproduce the issue.

Archive.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions