I have basically something such as :
var escape = function ( x ) {
if ( ! x ) return '\\N';
return '"' + x.replace( /\r\n/g, '\n' ) + '"';
};
array.forEach( function ( item ) {
process.stdout.write( 'foo:' + [ a, b, d ].map( escape ).join( '\t' ) + '\n' );
item.child.forEach( function ( sub ) {
process.stdout.write( 'bar:' + [ e, f, g ].map( escape ).join( '\t' ) + '\n' );
} );
} );
However, the output file contains, at apparently random locations, strings such as :
bar:\N "1981258" "Can't Get N^@^@^@^@^@^@^@^@^@^@Her Bones In Thefoo:"1981259" "164264"
bar:\N ^@ Left" \N \N
bar:^@^@^@ \N
It does not make sense for me, since the program should not be able to print anything without wrapping it into double quotes.
I think it’s a Node.js bug, due to this line, but I just want to know if there is a workaround.
b^@^@^@^@^@^@^@^@^@x 1 root root 1,5G 17 d\303\251c. 19:14 /D/Release.cs
It was probably an issue related to the filesystem were the file was wrote (vmhgfs). The second generated file did not have this garbage.