Skip to content

Update ejs.js#168

Open
enowit wants to merge 1 commit intotj:masterfrom
enowit:patch-1
Open

Update ejs.js#168
enowit wants to merge 1 commit intotj:masterfrom
enowit:patch-1

Conversation

@enowit
Copy link

@enowit enowit commented Apr 18, 2014

identify and remove BOM header.

new function:
line = 52

/**

  • Render an EJS file at the given path (easton changed)
  • @param {String} path
  • @param {String} encoding
  • @api private
    */
    function readEJSFile(path, encoding) {
    var buffer = read(path);
    if (buffer[0] == 239 && buffer[1] == 187 && buffer[2] == 191) {
    buffer = buffer.slice(3);
    }
    return buffer.toString(encoding);
    }

Able to identify and remove BOM header.

new function:
line = 52

/**
 * Render an EJS file at the given `path` (easton changed)
 * @param {String} path
 * @param {String} encoding
 * @api private
*/
function readEJSFile(path, encoding) {
    var buffer = read(path);
    if (buffer[0] == 239 && buffer[1] == 187 && buffer[2] == 191) {
        buffer = buffer.slice(3);
    }
    return buffer.toString(encoding);
}
@matthewhadley
Copy link

Is this the same as this rejected PR in express-handlerbars? ericf/express-handlebars#77 (comment)

@enowit
Copy link
Author

enowit commented Sep 23, 2014

I submitted a update, in Apr. but nobody reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants