<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Check if the string is valid for the specified encoding</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.mbstring.html">Multibyte String Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mb-convert-case.html">mb_convert_case</a></div> <div class="up"><a href="ref.mbstring.html">Multibyte String Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.mb-check-encoding" class="refentry"> <div class="refnamediv"> <h1 class="refname">mb_check_encoding</h1> <p class="verinfo">(PHP 4 >= 4.4.3, PHP 5 >= 5.1.3)</p><p class="refpurpose"><span class="refname">mb_check_encoding</span> — <span class="dc-title">Check if the string is valid for the specified encoding</span></p> </div> <div class="refsect1 description" id="refsect1-function.mb-check-encoding-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>mb_check_encoding</strong></span> ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$var</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span> [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code><span class="initializer"> = mb_internal_encoding()</span></span> ]] )</div> <p class="para rdfs-comment"> Checks if the specified byte stream is valid for the specified encoding. It is useful to prevent so-called "Invalid Encoding Attack". </p> <p class="para"> </p> </div> <div class="refsect1 parameters" id="refsect1-function.mb-check-encoding-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">var</code></em></span> <dd> <p class="para"> The byte stream to check. If it is omitted, this function checks all the input from the beginning of the request. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">encoding</code></em></span> <dd> <p class="para"> The expected encoding. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.mb-check-encoding-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.mbstring.html">Multibyte String Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mb-convert-case.html">mb_convert_case</a></div> <div class="up"><a href="ref.mbstring.html">Multibyte String Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>