question: public static void prepareUnicode ( final StringBuilder buffer , final ByteSequence sequence , final boolean trim , final boolean foldCase ) { Reject . ifNull ( buffer , sequence ) ; final int length = sequence . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { final byte b = sequence . byteAt ( i ) ; if ( ( b & 0x7F ) != b ) { MappingTable . map ( buffer , sequence . subSequence ( i , length ) , trim , foldCase ) ; String normalizedForm = Normalizer . normalize ( buffer , Form . NFKD ) ; buffer . setLength ( 0 ) ; buffer . append ( normalizedForm ) ; break ; } switch ( b ) { case ' ' : if ( canMapToSpace ( buffer , trim ) ) { buffer . append ( ' ' ) ; } break ; default : if ( b >= '	' && b < '' ) { if ( canMapToSpace ( buffer , trim ) ) { buffer . append ( SPACE_CHAR ) ; } } else if ( ( b >= '' && b <= '' ) || ( b >= '' && b <= '' ) || b == '' ) { break ; } else if ( foldCase && b >= 'A' && b <= 'Z' ) { buffer . append ( ( char ) ( b + 32 ) ) ; } else { buffer . append ( ( char ) b ) ; } break ; } } if ( trim ) { for ( int i = buffer . length ( ) - 1 ; i > 0 ; i -- ) { if ( buffer . charAt ( i ) == SPACE_CHAR ) { buffer . delete ( i , i + 1 ) ; } else { break ; } } } }
target:  Prepares an attribute or assertion value as per stringprep algorithm defined in RFC 4518.