node.js readfile error with utf8 encoded file on windows
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to load a UTF8 json file from disk using node.js (0.10.29) on Windows 8.1. The following is the code that runs: var http = require ( 'http' ); var utils = require ( 'util' ); var path = require ( 'path' ); var fs = require ( 'fs' ); var myconfig ; fs . readFile ( './myconfig.json' , 'utf8' , function ( err , data ) { if ( err ) { console . log ( "ERROR: Configuration load - " + err ); throw err ; } else { try { myconfig = JSON . parse ( data ); console . log ( "Configuration loaded successfully" ); } catch ( ex ) {