1
0
mirror of https://github.com/php/doc-fr.git synced 2026-03-24 07:02:06 +01:00
Files
archived-doc-fr/reference/mbstring/functions/mb-encode-numericentity.xml
Louis-Arnaud 06b1503807 reference/mbstring: fix grammar, spelling, terminology, and residual English (#2500)
- Fix depuis → à partir de (TRADUCTIONS.txt)
- Fix PostGreSQL → PostgreSQL
- Fix wrong byte count (4 → six octets)
- Fix plural agreements and gender agreements
- Fix residual English text
- Fix spelling errors (correspondence→correspondance, ailleur→ailleurs)
- Remove duplicate line in mb-get-info
2026-02-25 06:48:38 +01:00

189 lines
5.1 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: a60ef65239113c7871643be68ada91081376c936 Maintainer: yannick Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mb-encode-numericentity" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mb_encode_numericentity</refname>
<refpurpose>Encode les caractères en référence numérique HTML</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>mb_encode_numericentity</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam><type>array</type><parameter>map</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>hex</parameter><initializer>&false;</initializer></methodparam>
</methodsynopsis>
<para>
Convertit les codes des caractères spécifiés de la &string; <parameter>string</parameter>
en référence numérique HTML.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
La &string; à encoder.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>map</parameter></term>
<listitem>
<para>
<parameter>map</parameter> est un tableau qui spécifie les
codes à convertir.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>encoding</parameter></term>
<listitem>
&mbstring.encoding.parameter;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>hex</parameter></term>
<listitem>
<para>
Si l'entité de référence retournée devrait être en notation hexadécimale
(sinon il est en notation décimale).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
La &string; convertie.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<simpara>
Lève une exception <exceptionname>ValueError</exceptionname> si
<parameter>map</parameter> n'est pas une liste d'&integer;s.
</simpara>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
<function>mb_encode_numericentity</function> lève désormais une
exception <exceptionname>ValueError</exceptionname> si <parameter>map</parameter>
n'est pas une liste d'&integer;s.
</entry>
</row>
&mbstring.changelog.encoding-nullable;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemple avec <parameter>map</parameter></title>
<programlisting role="php">
<![CDATA[
<?php
$convmap = array (
int start_code1, int end_code1, int offset1, int mask1,
int start_code2, int end_code2, int offset2, int mask2,
........
int start_codeN, int end_codeN, int offsetN, int maskN );
// Spécifie les valeurs Unicode de début (start_codeN) et fin (end_codeN)
// Ajoutez offsetN à la valeur, et faites un ET bit-à-bit avec maskN, puis
// il convertit la valeur obtenue en entité numérique
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Exemple avec <function>mb_encode_numericentity</function></title>
<programlisting role="php">
<![CDATA[
<?php
$str = "aAæÆあア𩸽";
/* Convertit tous les caractères UTF-8 jusquà 4 octets en références numériques HTML */
$convmap = [0, 0x1FFFFF, 0, 0x10FFFF];
var_dump(mb_encode_numericentity($str, $convmap, "utf8"));
/* Convertit uniquement les caractères UTF-8 de 2 et 4 octets en références numériques HTML */
$convmap = [
0x80, 0x7FF, 0, 0x10FFFF,
0x10000, 0x1FFFFF, 0, 0x10FFFF,
];
var_dump(mb_encode_numericentity($str, $convmap, "utf8"));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(46) "&#97;&#65;&#230;&#198;&#12354;&#12450;&#40509;"
string(28) "aA&#230;&#198;あア&#40509;"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mb_decode_numericentity</function></member>
</simplelist>
</para>
</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:"~/.phpdoc/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
-->