Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 9
Registered: ‎06-09-2011
My Device: 9550 and 9800
My Carrier: GSM

Requested help on quoted-printable encoding and decoding

Hello Everybody,

 

I am new to blackberry development.

I have created a VCARD 2.1 and want to encode the strings in the VCARD as QuotedPrintable format.

Please guide me on the issue. I have tried with the commons-codec_1.3.jar and commons-codec_1.5.jar  but when i am trying to preverify the the jar files i am getting an error "Error preverifying class org.apache.commons.codec.StringEncoderComparator"   for the commons-codec_1.3.jar file.

 

My function is here:

when ever i am trying to create an object of  the quoted-printable type it is giving error and the application is terminating.

 

String getQUOTEDPRINTABLEString(String value){
       
             String temp = null;
            temp = value;
            QuotedPrintableCodec qpcObjCodec;

                try {
                    qpcObjCodec=new QuotedPrintableCodec();  // Error strting app: Module commons-codec_1.3 not found
                    temp = qpcObjCodec.encode(value);
                    String str=temp;
                } catch (Exception e) {
                    //e.printStackTrace();
                }

        return temp;

 

 

Please help on the issue if there is any other alternate way other than using the third party jar files.

 

Regards

Swananda

commons-codec_1.3.jar
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Requested help on quoted-printable encoding and decoding

You asked a very similar question yesterday didn't you?

 

http://supportforums.blackberry.com/t5/Java-Development/Requested-help-on-encoding-and-decoding-in-C...

 

The easiest thing to do would be to code this yourself.  You can use the source that is available from the apache classes as a guide and the wikipedia link I supplied in the other Thread gives you the specification, so this is actulaly a fairly straigtforward encoding. 

 

So you use UTF-8 to convert the text to bytes, and then use code like QuotedPrintableCodec to convert that byte array into a stream of ASCII text.