Questions tagged [encodingutil]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
38 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
1answer
39 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
1answer
340 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....
1
vote
1answer
959 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 ...
0
votes
1answer
199 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
1answer
189 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 ...
2
votes
1answer
767 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
1answer
54 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
1answer
37 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
1answer
785 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
1answer
949 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
1answer
171 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
1answer
191 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
1answer
1k 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
2answers
1k 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
1answer
4k 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
2answers
3k 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 ...
2
votes
1answer
3k 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. ...
12
votes
1answer
15k 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 ...
15
votes
4answers
8k 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
1answer
464 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
1answer
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 ...