Skip to main content

Questions tagged [encodingutil]

Filter by
Sorted by
Tagged with
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 ...
Shohrat Muhamov's user avatar
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\":\...
potato46's user avatar
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 = '...
sThirumagal93's user avatar
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. ...
Andrea Voggenreiter's user avatar
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 ...
SfdcBat's user avatar
  • 4,839
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....
GroundToCloud's user avatar
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 ...
Aakriti.G's user avatar
  • 506
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 ...
jessy's user avatar
  • 29
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 ...
Sneha Jagtap's user avatar
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 ...
Divya's user avatar
  • 91
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 ...
Ben Kass's user avatar
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. ...
Brohan's user avatar
  • 457
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 ...
LucidLunatic's user avatar
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, ...
raym0nd's user avatar
  • 886
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 ...
Hope's user avatar
  • 1,273
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 ...
Marty C.'s user avatar
  • 4,519
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 ...
David Dawson's user avatar
  • 1,204
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<...
Cloud SFDC's user avatar
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....
Testing_SFDC's user avatar
  • 2,968
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 ...
Testing_SFDC's user avatar
  • 2,968
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. ...
AnuRaj's user avatar
  • 2,482
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 ...
LMcDonald's user avatar
  • 463
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 ...
Sathya's user avatar
  • 3,242
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 ...
George S.'s user avatar
  • 2,740
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 ...
BritishBoyinDC's user avatar