Skip to end of metadata
Go to start of metadata

When using the HTTP interface, HostBridge command strings that include blanks and/or special characters must be URL encoded.

About URL Encoding

Uniform Resource Locators (URLs) are the method used to locate and access information over the Internet. URLs consist of a sequence of characters within the US-ASCII coded character set. URL encoding is a method for representing special characters with a “%” followed by the two hexadecimal digits that form the hexadecimal value of the character within the US-ASCII coded character set.  Safe characters include alphanumerical values [0-9, a-z, A-Z] and certain special characters -_.* (dash, underscore, period and asterisk). These characters can all exist within the URL without encoding because nearly all servers on the Internet will correctly interpret them. Characters that do not have a corresponding graphic character are unsafe, or are reserved for special purposes must be encoded.

  • URLs only use the graphic printable characters of the US-ASCII character set. Thus, characters not used in US-ASCII [80-FF hexadecimal] and control characters [00-1F and 7F hexadecimal] must be encoded.
  • Unsafe characters [<>"#%{}|\^~[]‘] and spaces may not be understood for a number of reasons and must be encoded.
  • Reserved characters [;/?:@=&] have special meanings that define the syntax of the URL. When these reserved characters are used for their special purposes, they can exist without modification
    within the URL. However, when they are used outside their purposes, they must be encoded.

Click here to review different techniques within HostBridge to do URL encoding within an HB.js script. 

The following table gives a list of common characters and their encoding.  Only the characters that are unsafe and may need to be encoded are included.   Unused characters are also not included.

Character

Encoding

Description

Entity


%09Horizontal tab

%0ALine Feed

&0DCarriage Return

%20Space
!%21Exclamation mark
"%22Quotation mark&quot;
#%23Number sign
$%24Dollar sign
%%25Percent sign
&%26Ampersand&amp;
'%27Apostrophe
(%28Left parenthesis
)%29Right parenthesis
+%2BPlus sign
,%2CComma
/%2FSolidus (slash)
:%3AColon
;%3BSemi-colon
<%3CLess than&lt;
=%3DEquals sign
>%3EGreater than&gt;
?%3FQuestion mark

@

%40Commercial at
[%5BLeft square bracket
\%5CReverse solidus (backslash)
]%5DRight square bracket
^%5ECaret

`

%60Acute accent
{%7BLeft curly brace
|%7CVertical bar
}%7DRight curly brace
~%7ETilde

A complete list of all characters and their encoding can be found here.

If your development environment is C#, you can use the HttpUtility.UrlEncode Method to encode the value portion. This will make sure that any special characters that URLs use are encoded so they are not misinterpreted. .

Similar methods will be available for other development environments.



  • No labels
Write a comment…