function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TShinchiTShinchi 

How to urlencode in Apex code?

Hello.

 

I want to urlencode in Apex code. But I cant't find any way.

 

String targetString = 'テスト用文字列';

String encodedString = URLENCODE(targetString);

 

 

If I can encode like above sample. But, It's occur Error.

 

Please tell me How to urlencode in Apex code.

 

kibitzerkibitzer

try

 

String encodedString = EncodingUtil.urlEncode(targetString,'UTF-8');

 

Dan

 

Karthik@TMCKarthik@TMC

Try This

 

targetString = EncodingUtil.URLENCODE(targetString,'UTF-8');

 

 

TShinchiTShinchi

Thank you.all.

 

I 've got it.