function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
saurabhguptasaurabhgupta 

need to convert a document in 8 bit ASCII Format

Hi

 

 

I m stuck in a code .Need some help

 

I have fired a Query on document and stored its body in a blob type variable 'BodyContent'

 

Document Doc =[Select Name, Id, Body From Document ];
        System.debug('Doc' + Doc);
        String FileName = Doc.Name;
        BodyContent=Doc.Body;

 

 

Now I m converting this blob to string using TOString() method     like this

 

String DocBody =  bodyContent.toString();

 

but i need to convert this document or string in 8 bit ASCII format

How can i do this.

Can anyone help?

imuino2imuino2

It seems to be a problem in salesforce, apparently theres isn't an easy way to solve this.

The most similar to a solution a could found is this post. I hope it helps

 

Ignacio.

saurabhguptasaurabhgupta

Hi

 

The issue is resolved

 

this can be done as follows:

 

String Docbody = EncodingUtil.base64Encode(bodyContent);

 

 

Thanks