PHP's RawURLEncode
is an implementation of RFC 3986. My websearch for that yields this Delphi unit which claims to implement RFC 3986.
I tested it on your input:
{$APPTYPE CONSOLE}
uses
System.SysUtils,
UURIEncode in 'UURIEncode.pas';
begin
Writeln(URIEncode('_%_&_+_=_ _"_''_a_b_c_d_e_f_g_h_'));
Readln;
end.
The output was:
_%25_%26_%2B_%3D_%20_%22_%27_a_b_c_d_e_f_g_h_
The key to my successful websearch was found in the PHP documentation for RawURLEncode
where is states:
URL-encode according to RFC 3986