Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.clearspace
Class URLUTF8Encoder

    java.lang.Object
      org.jivesoftware.openfire.clearspace.URLUTF8Encoder

    public class URLUTF8Encoder

extends Object

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. Created: 17 April 1997 Author: Bert Bos URLUTF8Encoder: http://www.w3.org/International/URLUTF8Encoder.java Copyright © 1997 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. This work is distributed under the W3C® Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231

Constructor Summary
`URLUTF8Encoder()`

Method Summary
`static String` | `encode(String s)` Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### URLUTF8Encoder

    public URLUTF8Encoder()

Method Detail

### encode

    public static String encode(String s)

  Encode a string to the "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

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.