Questions tagged [encodingutil]
The encodingutil tag has no usage guidance.
25 questions
2
votes
1
answer
206
views
Generate Cybersource digest in Apex
Cybersource is asking to generate a digest from payload using byte array. However we don't have bytes in apex. I'm getting SHA-256=k3t9b6mL4zCMDTOi7N1uLQMu9XxrjwOr5yRXnTG0G1A= hash when I try to ...
0
votes
1
answer
608
views
how to 'encode' the body in an HTTP body?
i am trying to send this body exactly as it looks
{
"table":"inquiries",
"response_type":"json",
"query_array":"{\"fname\":\...
0
votes
1
answer
397
views
Attachment content is empty
I have a boomi process which takes the file content and send it to salesforce to create attachment. But attachment is blank.
Here is my code:
String jsonStr = '...
0
votes
2
answers
2k
views
Encoding and Decoding BLOB due to error 'BLOB is not a valid UTF-8 string'
I try to encode and decode a BLOB in order to avoid the 'BLOB is not valid UTF-8 string' error, but when I encode the BLOB in UTF-8, decode it again and use the .toString-method, I stil get the error. ...
2
votes
1
answer
924
views
File saved using ContentVersion appears distorted or low quality
Using this link - Convert event.target.files into a JSON string I was able to get the file data. I form a JSON with like - {'fileName':xyz.jpeg,'file': <fileContent>} and pass it to an Apex ...
0
votes
1
answer
2k
views
base64 hash using HMAC SHA256
I am trying to compute the Apex equivalent of the following -
var shaBodyContent = CryptoJS.HmacSHA256(stringToSign, postman.getEnvironmentVariable("HMAC_SS"));
var b64BodyContent = shaBodyContent....
2
votes
1
answer
7k
views
How to get Base64 String from Binary String or UTF-8 String
I am reading a file and getting binary/ UTF-8 values from the file reader javascript. I want to convert that binary String or UTF-8 String to the base 64 String using apex.
I have tried with ...
1
vote
1
answer
678
views
Excel download characters got corrupted in lightning component?
Using lightning component i want to download the excel file with some contacts. I am able to get the contacts. But file downloading if my contact name is in other language like Chinese/Japanese, the ...
1
vote
1
answer
899
views
How to pass API endpoint URL containing \ to
I'm trying to pass the given URL to the setEndpoint method, but I'm getting an error.
This particular API URL contains backslash and maybe that's the problem because the code works fine with other ...
3
votes
1
answer
3k
views
Unable to read ANSI file in apex code?
I need to upload a file with ANSI character encoding from a VisualForce page and should be able to read the file and perform actions from Apex class(controller). Now when I upload an ANSI file, a ...
0
votes
1
answer
106
views
HttpRequest Converting > to?
I am using code (see below) that I found for sending an AWS SES message with an HttpRequest to amazon. I am able to send MIME messages with PDF attachments and all has been great.
Today, I tried ...
1
vote
1
answer
50
views
Comparing Message Authentication Codes in Apex
I'm trying to incorporate message authentication into an application I'm working on. Ideally, I need to verify that the MAC generated by the requester matches the recomputed MAC on the server side. ...
9
votes
1
answer
2k
views
Convert application/octet-stream in E-mail Processing class
Context: e-mails are sent with text attachments from a Dynamics SL/SQL Database to a Salesforce e-mail processor. The text attachments contain a formatted file with data to be processed and imported ...
1
vote
1
answer
2k
views
HmacSHA256 encoding in salesforce
I am trying to convert the following code from JAVA to Salesforce
JAVA:
byte[] key = BaseEncoding.base16().decode("wtv");
SecretKeySpec signingKey = new SecretKeySpec(key, ...
3
votes
1
answer
200
views
Upload .csv file to salesforce without converting its original encoding
I have created a functionality wherein I can upload a csv to salesforce. The problem I have at the moment is that when I try to upload an ANSI encoding, an error will occur 'Blob is not a valid UTF-8 ...
0
votes
1
answer
273
views
Where are the "==" characters in my base64-encoded value coming from?
I created a utility method TwitterUtil.encodeConsumerKeyAndSecret() to return the encoded credentials needed for Twitter's application-only authentication flow. However, when testing my method using ...
2
votes
1
answer
2k
views
Generate another ID by encoding the Salesforce ID
I am trying to generate another ID in Salesforce using a after insert, after update trigger. I wish to use this unique identifier as a URL parameter so it has to contain characters that are url ...
2
votes
2
answers
2k
views
Search Text in a PDF file (Attachments)
I am not able to search text in a pdf file tied to attachments(Notes and Attachments) using apex.Here is my apex code.
Pdf file contains 'County' text but it doesn't goes into if loop.
list<...
0
votes
1
answer
5k
views
unable to assign Blob variable that is returned by EncodingUtil.base64Decode(String) method [duplicate]
Unable to assign Blob variable that is returned by EncodingUtil.base64Decode(String) method
Blob k = EncodingUtil.base64Decode(call.Signature__c);
Attachment record = new Attachment(ParentId = call....
2
votes
2
answers
5k
views
How to use Blob.toPDF() method to create attachment body containing image and texts
I want to use Blob.toPDF() method to create attachment body, currently using:
attachmentPDF.Name = account.Name + '.pdf';
attachmentPDF.body = Blob.toPDF(pdfContent);`
Inside pdfContent I want to ...
3
votes
1
answer
8k
views
Invalid private key. Must be 32 bytes
I am trying to get connect with FB. For that i have installed the FB tool provided by saleforce and working on it. When the code try to decryptWithManagedIV i am getting error
Invalid private key. ...
15
votes
1
answer
26k
views
What is the best way to do HTML encoding and decoding in Apex?
I am programmatically building a HTML string in Apex and then saving it to a rich text field. The problem is that SalesForce is doing some HTML encoding on the string before it gets persisted which is ...
16
votes
4
answers
13k
views
Connect apex and Google API using JWT to retrieve Oauth 2.0 token
I have been trying to connect Salesforce and Google API using server to server application.
Intent :- To communicate data between Salesforce and Google Spreadsheet which is hosted in Google Sites ...
4
votes
1
answer
681
views
Is there a way to tell if a HTML hex colour is light or dark in Apex
I have a Visualforce Colorpicker that allows users to set a background-color.
I have access to this in Apex as a string, e.g. '#FF0000'. I want to know if this String is a dark color or a light ...
5
votes
1
answer
1k
views
Using Twitter's 1.1 API and RFC 1738 URL Encoding Requirement
I need to upgrade some code I have that uses Twitter's API to updates follower counts for their contacts, and the new API requires authentication. In reading this piece about it, I apparently need to ...