php-doc-en/reference/url/functions/rawurlencode.xml

75 lines
2.3 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/url.xml, last change in rev 1.6 -->
<refentry id="function.rawurlencode">
<refnamediv>
<refname>rawurlencode</refname>
<refpurpose>URL-encode according to RFC 1738</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>rawurlencode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string in which all non-alphanumeric characters except
<screen>-_.</screen> have been replaced with a percent
(<literal>%</literal>) sign followed by two hex digits. This is
the encoding described in RFC 1738 for protecting literal
characters from being interpreted as special URL delimiters, and
for protecting URL's from being mangled by transmission media
with character conversions (like some email systems). For
example, if you want to include a password in an FTP URL:
</para>
<example>
<title><function>rawurlencode</function> example 1</title>
<programlisting role="php">
<![CDATA[
echo '<a href="ftp://user:', rawurlencode('foo @+%/'),
'@ftp.my.com/x.txt">';
]]>
</programlisting>
</example>
<para>
Or, if you pass information in a PATH_INFO component of the URL:
</para>
<example>
<title><function>rawurlencode</function> example 2</title>
<programlisting role="php">
<![CDATA[
echo '<a href="http://x.com/department_list_script/',
rawurlencode('sales and marketing/Miami'), '">';
]]>
</programlisting>
</example>
<simpara>
See also <function>rawurldecode</function>,
<function>urldecode</function>,
<function>urlencode</function> and
<ulink url="&url.rfc;rfc1738.html">RFC 1738</ulink>
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->