Skip to content

Generated doc JSON is invalid utf-8 #2983

@rhys-vdw

Description

@rhys-vdw

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows WSL

What is the issue affecting?

Other

Expected Behaviour

JSON document output from --doc is standard utf-8 encoding.

Actual Behaviour

When trying to parse the JSON with our site builder, Ruby fails with:

jekyll 3.9.3 | Error:  (/home/rhys/spring/doc/site/_data/doc.json): invalid leading UTF-8 octet at line 1 column 1
/usr/share/rvm/rubies/ruby-3.2.3/lib/ruby/3.2.0/psych/parser.rb:62:in `_native_parse': (/home/rhys/spring/doc/site/_data/doc.json): invalid leading UTF-8 octet at line 1 column 1 (Psych::SyntaxError)
        from /usr/share/rvm/rubies/ruby-3.2.3/lib/ruby/3.2.0/psych/parser.rb:62:in `parse'
        from /usr/share/rvm/gems/ruby-3.2.3/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:143:in `load'

Opening the file in VSCode suggests that it is indeed utf-8, but clicking UTF-8 in the footer and then "Save with encoding > UTF-8" reserializes the file and the parser error is cleared.

Sorry I'm not more specific with the error, I don't know a great deal about file formats.

Reproduction steps

  1. Export docs
  2. Somehow check if they are properly encoded?

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions