question: static StringBuilder appendQuotedString ( StringBuilder target , String key ) { target . append ( '"' ) ; for ( int i = 0 , len = key . length ( ) ; i < len ; i ++ ) { char ch = key . charAt ( i ) ; switch ( ch ) { case '\n' : target . append ( "%0A" ) ; break ; case '\r' : target . append ( "%0D" ) ; break ; case '"' : target . append ( "%22" ) ; break ; default : target . append ( ch ) ; break ; } } target . append ( '"' ) ; return target ; }
target:  Appends a quoted-string to a StringBuilder. <p>RFC 2388 is rather vague about how one should escape special characters in form-data parameters, and as it turns out Firefox and Chrome actually do rather different things, and both say in their comments that they're not really sure what the right approach is. We go with Chrome's behavior (which also experimentally seems to match what IE does), but if you actually want to have a good chance of things working, please avoid double-quotes, newlines, percent signs, and the like in your field names.