From 47cad64a3f9a66398cfa88012f085b8d3c4f5d6f Mon Sep 17 00:00:00 2001 From: David Huynh Date: Wed, 24 Mar 2010 17:50:44 +0000 Subject: [PATCH] Properly unescape \t, \r, \n, \\. git-svn-id: http://google-refine.googlecode.com/svn/trunk@352 7d457c2a-affb-35e4-300a-418c747d4874 --- .../java/com/metaweb/gridworks/gel/Scanner.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/metaweb/gridworks/gel/Scanner.java b/src/main/java/com/metaweb/gridworks/gel/Scanner.java index ea6f43909..26630ad40 100644 --- a/src/main/java/com/metaweb/gridworks/gel/Scanner.java +++ b/src/main/java/com/metaweb/gridworks/gel/Scanner.java @@ -146,7 +146,18 @@ public class Scanner { } else if (c == '\\') { _index++; // skip escaping marker if (_index < _limit) { - sb.append(_text.charAt(_index)); + char c2 = _text.charAt(_index); + if (c2 == 't') { + sb.append('\t'); + } else if (c2 == 'n') { + sb.append('\n'); + } else if (c2 == 'r') { + sb.append('\r'); + } else if (c2 == '\\') { + sb.append('\\'); + } else { + sb.append(c2); + } } } else { sb.append(c);