Git Product home page Git Product logo

Comments (3)

gargi91 avatar gargi91 commented on June 6, 2024 1

Hey,

Thanks for your response.

After a little deep dive, I figured out a way. I found another library utf-8-validate to validate the source files. This library works well with all the source files I had including the one I generated from Redoc.

So, basically I created a plugin called frontmatterParser which will use this utf-8-validate library instead of is-utf8 library and to use my plugin I set the property frontmatter to false. This solved my problem.

from metalsmith.

webketje avatar webketje commented on June 6, 2024

Hi there,

Nothing does an "automatic utf-8 conversion". Having a <meta charset="utf-8"> tag does not convert the document to utf-8, it only informs the browser that the document should be interpreted as utf-8.

Metalsmith does a utf-8 check to know if the file is a text file or a binary file because binary files like images cannot contain front-matter and they need to be skipped. There are a lot of character encodings but UTF-8 is the most widely used and safe to detect.

So in this case either/or:

  • Redoc generates your metalsmith source files in a non-utf-8 encoding. You can check this by opening the document with an editor like Notepad++ which has charset re-encoding support. If I'm not mistaken (but I should test) Notepad on some Windows versions also saves text files as non-UTF8 by default (so if you opened a file with Notepad & saved it in another encoding without knowing it, the build will fail.
  • Redoc generates files with NULL-terminated strings for which there is a known bug in the is-utf8 package: wayfind/is-utf8#6

from metalsmith.

webketje avatar webketje commented on June 6, 2024

Closing as stale, feel free to comment if it needs to be reopened

from metalsmith.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.