Giter Site home page Giter Site logo

Error: Unknown encoding in Node.js 0.8 about ejs HOT 10 CLOSED

mde avatar mde commented on August 23, 2024
Error: Unknown encoding in Node.js 0.8

from ejs.

Comments (10)

TimothyGu avatar TimothyGu commented on August 23, 2024

We don't officially support Node.js 0.8, but I would be happy to apply fixes for it if it's not too ugly.

It seems to me that node 0.10 changed the second argument to readFileSync from a string specifying the encoding to an object containing that.

I'll push a fix using readFileSync(file).toString('utf8') using the Buffer.prototype.toString() function that did not change since 0.8. See if that fixes your problem.

from ejs.

TimothyGu avatar TimothyGu commented on August 23, 2024

See also 4ffd77f and 58e7f75. The latter commit was by me after I saw 4ffd77f.

from ejs.

dougwilson avatar dougwilson commented on August 23, 2024

I believe fs.readFileSync(fileName, 'utf8') still works on post Node.js 0.8, so that could be a solution as well (replace the options object with a string).

from ejs.

dougwilson avatar dougwilson commented on August 23, 2024

https://github.com/joyent/node/blob/v0.10.24/lib/fs.js#L274-L275

from ejs.

TimothyGu avatar TimothyGu commented on August 23, 2024

True but I'd rather use documented behavior.

from ejs.

TimothyGu avatar TimothyGu commented on August 23, 2024

I just tested on:

> console.log(process.versions)
{ http_parser: '1.0',
  node: '0.8.28',
  v8: '3.11.10.26',
  ares: '1.7.5-DEV',
  uv: '0.8',
  zlib: '1.2.3',
  openssl: '1.0.0m' }

Everything seems to work fine with Node.js 0.8. We are still not officially supporting 0.8 though because some of our devDependencies don't support it anymore.

from ejs.

dougwilson avatar dougwilson commented on August 23, 2024

Thanks, I appreciate making the change anyway :)

from ejs.

mde avatar mde commented on August 23, 2024

@dougwilson Do you need a bugfix release with this change?

from ejs.

dougwilson avatar dougwilson commented on August 23, 2024

@mde , no, take your time, I'm in no rush.

from ejs.

mde avatar mde commented on August 23, 2024

πŸ‘

from ejs.

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.