@SuppressWarnings("fallthrough") private String escapeCharacters(final String unescaped){
  if (TextUtils.isEmpty(unescaped)) {
    return "";
  }
  final StringBuilder tmpBuilder=new StringBuilder();
  final int length=unescaped.length();
  for (int i=0; i < length; i++) {
    final char ch=unescaped.charAt(i);
switch (ch) {
case ';':
{
        tmpBuilder.append('\\');
        tmpBuilder.append(';');
        break;
      }
case '\r':
{
      if (i + 1 < length) {
        char nextChar=unescaped.charAt(i);
        if (nextChar == '\n') {
          break;
        }
 else {
        }
      }
 else {
      }
    }
case '\n':
{
    tmpBuilder.append("\\n");
    break;
  }
case '\\':
{
  if (mIsV30OrV40) {
    tmpBuilder.append("\\\\");
    break;
  }
 else {
  }
}
case '<':
case '>':
{
if (mIsDoCoMo) {
  tmpBuilder.append('\\');
  tmpBuilder.append(ch);
}
 else {
  tmpBuilder.append(ch);
}
break;
}
case ',':
{
if (mIsV30OrV40) {
tmpBuilder.append("\\,");
}
 else {
tmpBuilder.append(ch);
}
break;
}
default :
{
tmpBuilder.append(ch);
break;
}
}
}
return tmpBuilder.toString();
}

@ SuppressWarnings ( "fallthrough" ) private String escapeCharacters ( final String unescaped ) { if ( TextUtils . isEmpty ( unescaped ) ) { return "" ; } final StringBuilder tmpBuilder = new StringBuilder ( ) ; final int length = unescaped . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { final char ch = unescaped . charAt ( i ) ; switch ( ch ) { case ';' : { tmpBuilder . append ( '\\' ) ; tmpBuilder . append ( ';' ) ; break ; } case '\r' : { if ( i + 1 < length ) { char nextChar = unescaped . charAt ( i ) ; if ( nextChar == '\n' ) { break ; } else { } } else { } } case '\n' : { tmpBuilder . append ( "\\n" ) ; break ; } case '\\' : { if ( mIsV30OrV40 ) { tmpBuilder . append ( "\\\\" ) ; break ; } else { } } case '<' : case '>' : { if ( mIsDoCoMo ) { tmpBuilder . append ( '\\' ) ; tmpBuilder . append ( ch ) ; } else { tmpBuilder . append ( ch ) ; } break ; } case ',' : { if ( mIsV30OrV40 ) { tmpBuilder . append ( "\\," ) ; } else { tmpBuilder . append ( ch ) ; } break ; } default : { tmpBuilder . append ( ch ) ; break ; } } } return tmpBuilder . toString ( ) ; }
append ' \ ' to the characters which should be escaped . the character set is different not only between vcard 2 . 1 and vcard 3 . 0 but also among each device . note that quoted - printable string must not be input here .
