info.bliki.wiki.filter
Class Encoder

java.lang.Object
  extended by info.bliki.wiki.filter.Encoder

public class Encoder
extends java.lang.Object

Some helper methods for encoding strings to HTML, URL or local files system names


Constructor Summary
Encoder()
           
 
Method Summary
static java.lang.String encodeHtml(java.lang.String text)
           
static void encodeHtml(java.lang.String text, java.lang.StringBuilder buffer)
          copy the text in the resulting buffer and escape special html characters (< > " & ')
static java.lang.String encodeTitleLocalUrl(java.lang.String wikiTitle)
          Encode name for local file system
static java.lang.String encodeTitleUrl(java.lang.String wikiTitle)
          Encode name for webbrowsers
static java.lang.String encodeUrl(java.lang.String s)
          Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal.
static boolean isUrlIdentifierPart(char ch)
          Determines if the specified character may be part of a url
static boolean isWikiPluginIdentifierPart(char ch)
          Determines if the specified character may be part of a wiki plugin identifier as other than the first character
static boolean isWikiPluginIdentifierStart(char ch)
          Determines if the specified character may be part the first character of a wiki plugin identifier
static char toChar(java.lang.String number)
           
static java.lang.String toEntity(int c)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Encoder

public Encoder()
Method Detail

toEntity

public static java.lang.String toEntity(int c)

toChar

public static char toChar(java.lang.String number)

encodeUrl

public static java.lang.String encodeUrl(java.lang.String s)
Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal. This is what happens: 8see http://www.w3.org/International/URLUTF8Encoder.java ) Exception: a ' ' (space) will be replaced by a '_' (underscore) not '+' (plus)

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

encodeTitleUrl

public static java.lang.String encodeTitleUrl(java.lang.String wikiTitle)
Encode name for webbrowsers


encodeTitleLocalUrl

public static java.lang.String encodeTitleLocalUrl(java.lang.String wikiTitle)
Encode name for local file system


encodeHtml

public static void encodeHtml(java.lang.String text,
                              java.lang.StringBuilder buffer)
copy the text in the resulting buffer and escape special html characters (< > " & ')

Parameters:
buffer - add converted text into the resulting buffer

encodeHtml

public static java.lang.String encodeHtml(java.lang.String text)

isUrlIdentifierPart

public static final boolean isUrlIdentifierPart(char ch)
Determines if the specified character may be part of a url


isWikiPluginIdentifierPart

public static final boolean isWikiPluginIdentifierPart(char ch)
Determines if the specified character may be part of a wiki plugin identifier as other than the first character


isWikiPluginIdentifierStart

public static final boolean isWikiPluginIdentifierStart(char ch)
Determines if the specified character may be part the first character of a wiki plugin identifier