Special characters in incoming openURLs
- Product: Primo, Primo VE
Description
Incoming openURLs from third party vendors might include values that contain an ampersand (&). For example:
/openurl?title=Food&Beverages&date=2018
Primo will then parse it by the '&' delimiter, causing a value word to be recognized as a parameter:
Parameter | Value |
title | Food |
Beverages |
{empty} |
date | 2018 |
When an incoming URL includes unencoded characters, this could impact the metadata integrity.
Resolution
According to ANSI/NISO Z39.88-2004 (R2010), page 41:
Values of KEV pairs must be URL- encoded to ensure that the KEV ContextObject Representation is ready to be transported over the HTTP(S) protocol. URL-encoding eliminates confusion that could occur when special characters, such as equals character (‘=’) and ampersand character (‘&’), are used within values of KEV pairs.
Rules for URL-encoding values are:
Rules for URL-encoding values are:
- The alphanumeric characters (letters and digits), the period character (‘.’), the hyphen character (‘-’), the asterisk character (‘*’), and the underscore character (‘_’) remain the same.
- The space character (‘ ’) is converted into a plus sign (‘+’) or into the character string “%20”.
- For all other characters, each byte of the character is converted into a three-character string “%XY” where “XY” is the two-digit hexadecimal representation of the byte.
Therefore, to avoid values from being parsed as parameters, the special characters must be encoded before arriving to Primo. For example:
/openurl?title=Food%26Beverages&date=2018
Parameter | Value |
title | Food%26Beverages |
date |
2018 |
- Article last edited: 14-Aug-2018