title: Escaping double Quotes in String
body: <p>How do i escape double quotes in string in Grails :</p>
  
  <pre><code>string  = " "12.10 On-Going Submission of ""Made Up"" Samples." "
  </code></pre>
  
  <p>I have tried alot of methods </p>
  
  <pre><code>//text : artifact.text.encodeAsJavaScript(),
  //text: artifact.text.encodeAsHTML(),           
  //text: StringEscapeUtils.escapeJava((String)artifact.text), //got an error when doing this     
  //text: artifact.text.replaceAll("\" "," \\\\" "),
  </code></pre>
  
  <p>None of the above worked for me. You can refer to question posted by for understanding myproblem <a href="https://stackoverflow.com/questions/26025673/json-issues-with-rest-api-and-special-characters">here</a>
  and <a href="https://stackoverflow.com/questions/26039819/escape-string-in-grails-to-avoid-json-error">here</a> too</p>
  
  <p>the error (json stops at "\\"12.10 On-Going Submission o\\"\\""):</p>
  
  <pre><code>014-09-25 12:15:21,869 [http-bio-8080-exec-3] ERROR errors.GrailsExceptionResolver  - StringIndexOutOfBoundsException occurred when processing request: [GET] /artifact - parameters:
  documentName: ICENSE AGREEMENT6
  String index out of range: -28. Stacktrace follows:
  Message: String index out of range: -28
      Line | Method
  -&gt;&gt; 1911 | substring      in java.lang.String
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   1946 | subSequence    in     ''
  |   1042 | append . . . . in java.io.PrintWriter
  |     56 | append         in     ''
  |    180 | value . . . .  in grails.converters.JSON
  |    162 | convertAnother in     ''
  |    202 | value . . . .  in     ''
  |    162 | convertAnother in     ''
  |    202 | value . . . .  in     ''
  |    162 | convertAnother in     ''
  |    202 | value . . . .  in     ''
  |    162 | convertAnother in     ''
  |    202 | value . . . .  in     ''
  |    162 | convertAnother in     ''
  |    202 | value . . . .  in     ''
  |    134 | render         in     ''
  |    150 | render . . . . in     ''
  |    325 | $tt__index     in com.thomsonreuters.ald.aeandsdx.ArtifactController$$EOqtIczI
  |    198 | doFilter . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
  |     63 | doFilter       in grails.plugin.cache.web.filter.AbstractFilter
  |   1145 | runWorker . .  in java.util.concurrent.ThreadPoolExecutor
  |    615 | run            in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    745 | run . . . . .  in java.lang.Thread
  </code></pre>