Hi, I'm completely new to Groovy and am trying to replace the 3 versions of the double quotes with 2 single quotes in a large CSV file. I've managed to get the script below working but the input file encoding is UTF8 and the output file comes out as "Western (Mac OS Roman)".
Any help would be greatly appreciated, Thanks
File myInFile = new File( myFilePathStart );
myOutFile = new File( myFilePathEnd );
myOutFile.withWriter { out ->
myInFile.eachLine { line ->
myOutFileText = line.replaceAll(""", "''");
myOutFileText = myOutFileText.replaceAll("“", "''");
myOutFileText = myOutFileText.replaceAll("”", "''");
myOutFileText = myOutFileText + "n";
out << myOutFileText;
}
};
return true;