Class StringPrep

java.lang.Object
com.ibm.icu.text.StringPrep

public final class StringPrep extends Object
StringPrep API implements the StingPrep framework as described by RFC 3454. StringPrep prepares Unicode strings for use in network protocols. Profiles of StingPrep are set of rules and data according to which the Unicode Strings are prepared. Each profiles contains tables which describe how a code point should be treated. The tables are broadly classied into
  • Unassigned Table: Contains code points that are unassigned in the Unicode Version supported by StringPrep. Currently RFC 3454 supports Unicode 3.2.
  • Prohibited Table: Contains code points that are prohibited from the output of the StringPrep processing function.
  • Mapping Table: Contains code points that are deleted from the output or case mapped.
The procedure for preparing Unicode strings:
  1. Map: For each character in the input, check if it has a mapping and, if so, replace it with its mapping.
  2. Normalize: Possibly normalize the result of step 1 using Unicode normalization.
  3. Prohibit: Check for any characters that are not allowed in the output. If any are found, return an error.
  4. Check bidi: Possibly check for right-to-left characters, and if any are found, make sure that the whole string satisfies the requirements for bidirectional strings. If the string does not satisfy the requirements for bidirectional strings, return an error.