Package org.apache.commons.codec.net

Examples of org.apache.commons.codec.net.QuotedPrintableCodec.encode()


 
  @Test
  public void testQuotedPrintableEncoding_1() throws UnsupportedEncodingException {
    String text = "This is a string with no special characters.";
    QuotedPrintableCodec QPC = new QuotedPrintableCodec();
    String encodedText = QPC.encode(text, "UTF8");
    assertEquals(text, encodedText);
  }
 
  @Test
  public void testQuotedPrintableEncoding_2() throws UnsupportedEncodingException {
View Full Code Here


  public void testQuotedPrintableEncoding_2() throws UnsupportedEncodingException {
    String text = "This is a string with special characters 新中西里杨阿姨.";
    String expected = "This is a string with special characters =E6=96=B0=E4=B8=AD=E8=A5=BF=E9=87=8C=E6=9D=A8=E9=98=BF=E5=A7=A8.";
   
    QuotedPrintableCodec QPC = new QuotedPrintableCodec();
    String encodedText = QPC.encode(text, "UTF8");
    assertEquals(expected, encodedText);
  }
 
  @Test
  public void testForceEncodeQuotedPrintableSpaces_1() throws VCardBuildException {
View Full Code Here

  // Encode RFC 1521 MIME (Multipurpose Internet Mail Extensions)
  // Part One. Rules #3, #4, and #5 of the quoted-printable spec are not implemented yet
  private static String encodeRfc1521(final String encodeText) {
    final QuotedPrintableCodec codec = new QuotedPrintableCodec();
    try {
      return codec.encode(encodeText);
    } catch (final EncoderException e) {
      return "Error: Sting input cannot be decoded";
    }
  }
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.