+ Start a Discussion
Mani PenumarthiMani Penumarthi 

How to convert the special charaters while working with SOAP services

Here is the example how I was getting a data from webservices with special character ( ' ) in string

String text = 'dlafdhfasdfsd ' dsdfsdfdsfsd' ;

How could I dynamically convert such special characters.

pconpcon
You could use the escapeSingleQuotes method

String escapedText = String.escapeSingleQuotes(text);
Mani PenumarthiMani Penumarthi
Thanks pcon. It worked fine for this senario. Is there any other way to skip special charaters such "&,$,etc..," as I need to pass this values in the URL.
pconpcon
Then you'll want to use EncodingUtils

String escapedText = EncodingUtil.urlEncode(text, 'UTF-8');