URL Encoding Requirements and Considerations
When constructing PTC RV&S client URLs, encoding is required for the values of the command options only (do not encode the entire URL).
PTC RV&S assumes all incoming PTC RV&S client URLs are encoded as per RFC 1738 to ensure all URL data can be converted to and from UTF-8. All encoding and decoding uses the UTF-8 encoding scheme for maximum compatibility, as per the WWW Consortium recommendations. For example, a space character will be encoded as %20. For more information, browse to http://docs.oracle.com/javase/8/docs/api/java/net/URLEncoder.html.
All illegal characters are encoded with a percent (%) character followed by the two-digit hexadecimal representation of the ISO-Latin code point for the character.
The following are examples of PTC RV&S client URLs with encoded options:
integrity://localhost:9001/im/viewissue?selection=12345&asof=%222012-01-01%2014%3a01%3a00%20z%22
where 2012-01-01 12:01:00 z is encoded.
integrity://localhost:9001/si/viewproject?project=%2FTestProject%2Fproject.pj
where /TestProject/project.pj is encoded.
integrity://localhost:9001/im/viewissue?selection=12345&asof=jwWiki%20%e3%82%a2%e3%83%bc%e3%83%86%e3%82%a3%e3
integrity://localhost:9001/extended-web-ui/%2Fitems%3Fquery%3DA%2A%21-_ is encoded.
integrity://localhost:9001/extended-web-ui/%2Fitems%3Fquery%3Dquick%20query is encoded.
%82%af%e3%83%ab
where asof=jwWiki アーティクル is encoded
When writing custom trigger scripts or custom actions that generate PTC RV&S client URLs, PTC recommends that you use standard libraries like java.net.Encoder to encode the values of command options in the URL. For example, you can encode by calling the java encoder class
java.net.URLEncoder.encode(some_URL, "UTF-8")
This encoder class conforms to RFC 1738 (the URL specification) and guarantees the PTC RV&S client URL will be properly decoded by the PTC RV&S client when launched. For more information, browse to http://www.rfc-editor.org/rfc/rfc1738.txt.
The trigger script file changePackageNotification.js uses this java class to encode the command options in its PTC RV&S client URLs, as shown in the following example:
/** 
* Return a URL-encoded string version of the argument passed in.
*/
function urlEncode(arg)
{
try {
return java.net.URLEncoder.encode(arg,"UTF-8");
} catch (err) {
// Fall-through
}
// If UTF-8 failed, just use the default encoding.
return java.net.URLEncoder.encode(arg);
}
The following table describes the requirements and considerations for encoding the values of command options in PTC RV&S client URLs:
Character Types
Coding Requirements/Considerations
ASCII Control Characters
All characters within the range 00-1F and 7F must be encoded.
Reserved Characters
The following special characters are reserved:
dollar sign ($) encode %24
ampersand (&) encode %26
plus sign (+) encode %2B
comma (,) encode %2C
forward slash mark (/) encode %2F
colon (:) encode %3A
semi-colon (;) encode %3B
equal sign (=) encode %3D
question mark (?) encode %3F
at sign (@) encode %40
star ( * ) encode %2A
exclamation ( ! ) encode %21
Unsafe Characters
Some special characters present the possibility of being misunderstood within URLs, for example, they could be incompatible or unreliable. PTC recommends encoding the following characters:
blank space ( ) encode %20 (especially multiple spaces)
quotation marks (“”) encode %22
less than sign (\<) encode %3C
greater than sign (\>) encode %3E
number sign (#) encode %23
percent (%) encode %25
left brace ({) encode %7B
right brace (}) encode %7D
vertical bar/pipe (|) encode %7C
backslash (\) encode %5C
caret (^) encode %5E
tilde (~) encode %7E
left bracket ([) encode %5B
right bracket (]) encode %5D
grave accent (`) encode %60
Supported Special Characters
The following special characters are allowed and do not need encoding:
hyphen ( - ) encode -
underscore ( _ ) encode _
Non-ASCII Characters
All non-ASCII characters must be encoded. This includes the entire top half of the ISO-Latin set 80-FF hexadecimal.
Unicode Characters
All unicode characters must be encoded. This includes everything above FF.
Was this helpful?