Using a special character in a URI
Visualization Platform URIs use encoding for characters that a browser can misinterpret. The following example uses hexadecimal encoding in the Visualization Platform URI to display the report, Newsfeed.rptdesign, from an Encyclopedia volume:
http://127.0.0.1:8700/iportal/executereport.do?__requesttype=
immediate&__executableName=%2fNewsfeed%2erptdesign&__vp=server1
You do not have to use hexadecimal encoding in all circumstances. Use the encoding only when the possibility of misinterpreting a character exists. The following unencoded URI displays the same report as the preceding URI:
http://127.0.0.1:8700/iportal/executereport.do?__requesttype=
immediate&__executableName=\Newsfeed.rptdesign&__vp=server1
Always encode characters that have a specific meaning in a URI when you use them in other ways.
Table 25‑1 describes the available character substitutions. An ampersand introduces a parameter in a URI, so you must encode an ampersand that appears in a value string. For example, use:
&company=AT%26T
instead of:
&company=AT&T
Table 25‑1 Encoding sequences for use in URIs
Character | Encoded substitution |
ampersand (&) | %26 |
asterisk (*) | %2a |
at (@) | %40 |
backslash (\) | %5c |
colon (:) | %3a |
comma (,) | %2c |
dollar sign ($) | %24 |
double quote (") | %22 |
equal (=) | %3d |
exclamation (!) | %21 |
forward slash (/) | %2f |
greater than (>) | %3e |
less than (<) | %3c |
number sign (#) | %23 |
percent (%) | %25 |
period (.) | %2e |
plus (+) | %2b |
question mark (?) | %3f |
semicolon (;) | %3b |
space ( ) | %20 |
underscore (_) | %5f |
If you customize Visualization Platform by writing code that creates URI parameters, encode the entire parameter value string with the encode( ) method. The encode( ) method is included in encoder.js, which is provided in the Visualization Platform <context root>/js directory. The following example encodes the folder name /Training/Sub Folder before executing the getFolderItems action:
<%-- Import the StaticFuncs class. --%>
<%@ page import="com.actuate.reportcast.utils.*" %>
<%
String url = "http://127.0.0.1:8700/iportal/getfolderitems.do?folder=" +
StaticFuncs.encode("/Training/Sub Folder");
response.sendRedirect(url);
%>
The encode( ) method converts the folder parameter value from:
/Training/Sub Folder
to:
%2fTraining%2fSub%20Folder
UTF-8 encoding
All communication between Visualization Platform and iHub uses UTF-8 encoding. UTF-8 encoding is the default encoding that web browsers support. For 8-bit (single-byte) characters, UTF-8 content appears the same as ANSI content. However, if extended characters are used (typically for languages that require large character sets), UTF-8 encodes these characters with two or more bytes.
UTF-8 encoding support is encoded for all Visualization Platform web pages. When customizing these pages or adding customized web pages to an Visualization Platform web application, provide UTF-8 encoding support using the following code:
<META
HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">