com.google.visualization.datasource.render
Class EscapeUtil

java.lang.Object
  extended by com.google.visualization.datasource.render.EscapeUtil

public class EscapeUtil
extends java.lang.Object

A utility to escape strings.

Author:
Hillel M.

Method Summary
static java.lang.String htmlEscape(java.lang.String str)
          Escapes the string for embedding in html.
static java.lang.String jsonEscape(java.lang.String str)
          This method is used to escape strings embedded in the json response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

jsonEscape

public static java.lang.String jsonEscape(java.lang.String str)
This method is used to escape strings embedded in the json response. The method is based on org.apache.shindig.common.JsonSerializer.appendString(). The method escapes the following in order to enable safe parsing of the json string: 1) single and double quotes - ' and " 2) backslash - / 3) html brackets - <> 4) control characters - \n \t \r .. 5) special characters - out of range unicode characters (formatted to the uxxxx format)

Parameters:
str - The original string to escape.
Returns:
The escaped string.

htmlEscape

public static java.lang.String htmlEscape(java.lang.String str)
Escapes the string for embedding in html.

Parameters:
str - The string to escape.
Returns:
The escaped string.


Copyright © 2009 Google. All Rights Reserved.