public static String encode ( final String s ) { /* * try { return URLEncoder.encode(s, ENCODING_CHARSET); } catch (UnsupportedEncodingException use) { * log.error("Error ocurred encoding URI [" + s + "]", use); } */ /* * Lotus Notes does not correctly strip angle brackets from cid uris. From RFC2392: A "cid" URL is converted to * the corresponding Content-ID message header [MIME] by removing the "cid:" prefix, converting the % encoded * character to their equivalent US-ASCII characters, and enclosing the remaining parts with an angle bracket * pair, "<" and ">". For example, "cid:foo4%25foo1@bar.net" corresponds to Content-ID: <foo4%25foo1@bar.net> * Reversing the process and converting URL special characters to their % encodings produces the original cid. A * "mid" URL is converted to a Message-ID or Message-ID/Content-ID pair in a similar fashion. */ if ( CompatibilityHints . isHintEnabled ( CompatibilityHints . KEY_NOTES_COMPATIBILITY ) && CID_PATTERN . matcher ( s ) . matches ( ) ) { return NOTES_CID_REPLACEMENT_PATTERN . matcher ( s ) . replaceAll ( "" ) ; } return s ; }
Encodes the specified URI string using the UTF - 8 charset . In the event that an exception is thrown the specifed URI string is returned unmodified .