Escape strings from TSV exporter.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@485 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-04-16 06:45:57 +00:00
parent 1e5a787281
commit 67662fcc96

View File

@ -63,7 +63,14 @@ public class TsvExporter implements Exporter {
Cell cell = row.cells.get(cellIndex); Cell cell = row.cells.get(cellIndex);
if (cell != null && cell.value != null) { if (cell != null && cell.value != null) {
Object v = cell.value; Object v = cell.value;
writer.write(v instanceof String ? ((String) v) : v.toString()); String s = v instanceof String ? ((String) v) : v.toString();
s = s.replace("\\", "\\\\")
.replace("\n", "\\n")
.replace("\r", "\\r")
.replace("\t", "\\t");
writer.write(s);
} }
} }
} }