Skip to content

Has issue with Byte Order Marker char - error "Unexpected character 'ï' on line 1." #418

Description

@dylandhall

I have some json files that were created in windows, and if I try to use fx with them I get the error "Unexpected character 'ï' on line 1."

If I open it in Kate, go to tools and deselect "Add Byte Order Mark (BOM)" in the tools menu and save, the error disappears, so it's definitely the BOM.

It would probably be good to detect and handle the character so all files are usable.

SO post about the same issue: https://stackoverflow.com/questions/17754507/how-do-i-get-rid-of-this-character-%C3%AF

You also fixed a similar issue in streaming in issue #238 so it's likely you already have a solution.

Edit: had a really quick browse of the codebase, it looks like the skipWhitespace() method at https://github.com/antonmedv/fx/blob/master/internal/jsonx/json.go#L580 could probably just be extended to include the special character.

Let me know if you want me to see if I can do that and submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions