Questions tagged [escape]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
43 views

Test Class Failing due to NullPointerException

I have stored the SharedSecret and AccesskeyId in a custom setting. The shared secret has reserved characters. This is a sample sharedsecret 'abc'\1@pQr&^%HGF45abcc' In apex code I am ...
0
votes
1answer
41 views

Escaping reserved characters from a string stored in custom setting

I want to get mykey stored in custom setting and escape the reserved characteres. originalstring = 'abc123def'pqr456\eryt' ; // escaping the reserved charatcters String ...
2
votes
1answer
973 views

Escaping single quote character breaks String.format(stringToFormat, formattingArguments) [duplicate]

When I run this code: String.format('Dear {0}, Don\'t forget .... {1} .... {2}', args); Token 0 is replaced, but token 1 and 2 appear as {1} and {2} This is caused by the backslash escaping the ...
3
votes
1answer
477 views

How do I escape the “<” and “>” characters?

if(String.isNotEmpty(orderItem.Nickname_2__c)){ notes += '<p><strong>Nickname 2:</strong> ' + orderItem.Nickname_2__c + '</p>'; I've a class that collects input from a few ...
3
votes
0answers
56 views

How can I escape this character ► to be shown correctly on ExactTarget?

When I test an email with the character ► using other methods it works ok, but after sending through ExactTarget it gets rendered incorrectly by the most part of mobile email clients. How can I ...
0
votes
1answer
69 views

EscapeSingleQuotes vf page button

I have a button that when clicked triggers actions in the controller. Which among other things triggers a query. My text has a single quote in it such as " Dan's Product " In the query I used ...
6
votes
3answers
10k views

Lightning component to render a rich text field unescaped

Trying to do something fairly simple I think and query a FeedItem record then display its body in a lightning component. Issue I have is that I cant work out how to display the body unescaped. In ...
0
votes
1answer
99 views

The string 'null' appears at the beginning of my CSV output [duplicate]

I am trying to create a CSV in the batch. global void finish(Database.BatchableContext BC) { for(ID a: temp) { String recordString = '"'+a+'"\n'; finalstring = finalstring + ...
2
votes
1answer
344 views

SOQL Injection protection

I'm facing an issue on code scanning. The following code has second order error. TestList = [SELECT Id, name, address FROM Object__c where Id IN: TestIddSet]; TestList is a list of the Object__c. ...
3
votes
1answer
373 views

Regex problems in Apex

I'm especially terrible with Regex, but reworked one I found online to suit my needs, but it keeps throwing the "no viable alternative at character '\'" error. This pattern works when tested in ...
4
votes
1answer
345 views

How to programmatically double apostrophes in custom label translations?

I have a custom label which contains a couple of parameters: Hello, {0} the other param is {1}. I wish to output this value in a Visualforce Page like so: <apex:variable var="firstParam" value="...
1
vote
1answer
1k views

Escape backslash

I'm trying to define a string with the following value string s = 'Something\Something'; but I got Illegal character sequence '\S' in string literal. I tried escaping the backlash with another ...
1
vote
1answer
2k views

How to include/escape a single quote in field update?

I've got a field update where I'd like to include a single quote, basically the contact's name and an apostrophe. I've got it close with the following Contact__r.Name + '\'s Submission' This gets ...
7
votes
2answers
4k views

String.format escape curly braces

Is there a way to escape curly braces within String.format? E.g. if I want to get the following output: {777} I'd expected {{ would do the job but this code throws an exception: String.format('...
2
votes
1answer
1k views

Any single method available to escape unicode, single and double quotes

Is there any method similar to "escapeSql" that is available on SalesForce platform. This would be a great feature and will be very useful method for companies whose data is global where Names might ...
3
votes
3answers
2k views

FIND {query} with special characters failing with ampersand

FIND {tim/?jacob} parses perfectly fine when running the query. FIND {tim/&jacob} gives the following error: line 1:10 mismatched character '&' expecting '}'` what am I doing wrong? ...
3
votes
2answers
94 views

Is there a way to have APEX field values written to a page unescaped

I would like to do this, have escape false... <apex:outputText value="{!myUrlField}" escape="false"/> ...when I am using a bracketed call: {!myUrlField} Specifically, this is for writing ...
3
votes
1answer
713 views

Interpreting wildcards (eg, * and &) in SOSL queries through the API. Escape or not?

I have a search feature that is implemented with the AJAX toolkit to use SOSL. var results = sforce.connection.search("FIND {" + sanitize(...) + "} IN NAME FIELDS RETURNING ..."); The sanitize(...) ...
3
votes
5answers
2k views

Function to properly escape dynamic SOSL input

I have a page that allows users to specify a search term that then gets put into a SOSL Query. Obviously I'm escaping single quotes to prevent injection, but certain input still cause my code to ...
7
votes
1answer
5k views

How to Escape Single Quotation Mark in String.format

I'm using the translation workbench to translate a custom label(mail's body) to English. In the message, there was a word "haven't". When I check the test email, the word showed up as "havent". I ...
2
votes
1answer
2k views

SOQL done right. SOQL-Injection secure

I was looking for some reassurance that all that needs to be done (and its best practice) when doing dynamic SOQL is to use escapeSingleQuotes. There was a query like this string query = 'SELECT ' + ...
4
votes
1answer
1k views

Trigger - SObject.addError with html tags always escape

I believe it's a known issue, but I was wondering if there is still no work around this. In my trigger, sobject.addError always escape my html tags even if I set escape to false. This is really ...