PayPalEmailURLUTF8Encoder Class Reference

Collaboration diagram for PayPalEmailURLUTF8Encoder:

Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static String encode (String s)

Static Package Attributes

static final String[] hex


Detailed Description

This class originally came from the w3c.org We have to customize this encoding because PayPal expects the "/" character to be unencoded in an "email link" submission. This is a hack-and-a-half. Stupid non-compliant implementations. Grumble. Grumble. - TC Map of PayPal's e-mail link character encoding scheme -- sorry, but this map sort-of follows a US qwerty keyboard layout

The lower ASCII chars and behave as expected: abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

Here's how the numbers and upper ASCII behave: (numbers are normal) ` 1 2 3 4 5 6 7 8 9 0 - = 60 1 2 3 4 5 6 7 8 9 0 - 3D

~ ! @ # $ % ^ & * ( ) _ + 7E 21 40 23 24 25 5E 26 * 28 29 _ 2B

[ ] \ { } | ; ' : " , . / < > ? 5B 5D 5C 7B 7D 7C 3B 27 3A 22 2C . / 3C 3E 3F Provides a method to encode any string into a URL-safe form. Non-ASCII characters are first encoded as sequences of two or three bytes, using the UTF-8 algorithm, before being encoded as HH escapes.


Member Function Documentation

static String encode ( String  s  )  [static]

Encode a string to the "special" PayPal version of "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal. This is what happens:

  • The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.

  • The unreserved characters - _ . / remain the same.

  • The space character ' ' is converted into a plus sign '+'.

  • All other ASCII characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the character code.

  • All non-ASCII characters are encoded in two steps: first to a sequence of 2 or 3 bytes, using the UTF-8 algorithm; secondly each of these bytes is encoded as "%xx".

Parameters:
s The string to be encoded
Returns:
The encoded string


Member Data Documentation

final String [] hex [static, package]

Array of hex conversions for characters.


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:37 2012 for Project Wonder by  doxygen 1.5.8