Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Converting Base64 encoded String to String object

807588Apr 9 2009 — edited Apr 9 2009
Hi,

Description:
I have a Base64 encoded string and I am using this API for it,
[ http://ws.apache.org/axis/java/apiDocs/org/apache/axis/encoding/Base64.html]
I am simply trying to convert it to a String object.

Problem:
When I try and write the String, ( which is xml ) as a XMLType to a oracle 9i database I am getting a "Cannot map Unicode to Oracle character." The root problem is because of the conversion of the base64 encoded string to a String object. I noticed that some weird square characters show up at the start of the string after i convert it. It seems like I am not properly converting to a String object. If i change the value of the variable on the fly and delete these little characters at the start, I don't get the uni code error. Just looking for a second thought on this.

Code: Converting Base64 Encoded String to String object
public String decodeToString( String base64String )
{
    
    byte[] decodedByteArray = Base64.decode( base64String );
    String decodedString = new String( decodedByteArray, "UTF-8");

}
Any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2009
Added on Apr 9 2009
9 comments
1,583 views