Skip to content

Spurious compilation failure when sketch code file has "UTF-8 with BOM" encoding #3015

@nikthefix

Description

@nikthefix

Describe the problem

Recently I've found that simple alpha-numeric multi-line comments (no back slashes etc) are sometimes the cause of build failure in unpredictable ways. It appears to be associated with any white space lines between the comment block and code. Deleting blank lines always cures the problem but that is the only reproducible effect.

Examining the hex edit of an offending sketch reveals that in some cases (but not all) the UTF-8-BOM encoding header characters are the cause. If these characters are cut then the .ino builds just fine.

In other cases there are no such rogue characters yet the problem remains.

To reproduce

Appears random in my experience so not reproducible by me.

Expected behavior

I expect a

/* comment */ 

to have no impact on the build.

I expect a

/* multi
    line
    comment */ 

to have no impact on the build.

I expect that added white-space helping the readability of the code will have no impact on the build.

Arduino CLI version

Original report

1.2.0 (Arduino IDE 2.3.6)

Last verified with

504b43e

Operating system

Windows

Operating system version

11

Additional context

Additional reports

Related

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions