From 308ad69eeb833dcb7df96b9b4b47f9e73cc5ae0e Mon Sep 17 00:00:00 2001 From: greelgorke Date: Thu, 17 Jan 2013 10:23:56 +0100 Subject: [PATCH] set encoding for reader to utf8 --- Readme.md | 1 + lib/log.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 14db231..521699a 100644 --- a/Readme.md +++ b/Readme.md @@ -47,6 +47,7 @@ Instead of the log level constants, you may also supply a string: console.log(line); }); + __Note: log.js asumes utf8 encoded data.__ Example stdout: { date: Sun, 26 Sep 2010 01:26:14 GMT diff --git a/lib/log.js b/lib/log.js index 41daac2..dbf3eca 100644 --- a/lib/log.js +++ b/lib/log.js @@ -107,7 +107,7 @@ Log.prototype = { , self = this , stream = this.stream; - stream.setEncoding('ascii'); + stream.setEncoding('utf8'); stream.on('data', function(chunk){ buf += chunk; if ('\n' != buf[buf.length - 1]) return; @@ -250,4 +250,4 @@ Log.prototype = { * Inherit from `EventEmitter`. */ -Log.prototype.__proto__ = EventEmitter.prototype; \ No newline at end of file +Log.prototype.__proto__ = EventEmitter.prototype;