Null-terminated multibyte strings
Une chaîne multi-octets terminée par NUL (« NUL terminated multi-byte string », ou NTMBS), ou simplement « chaîne multi-octets », est une séquence d'octets non nuls suivi par un octet de valeur zéro (le caractère NUL final).
Chaque caractère stocké dans la chaîne peut occuper plus d'un octet. Le codage utilisé pour représenter les caractères dans une chaîne de caractères multi-octets est spécifique aux paramètres régionaux : il peut être UTF-8, GB18030, EUC-JP, Shift-JIS, etc. Par exemple, le tableau de caractères {'\xe4','\xbd','\xa0','\xe5','\xa5','\xbd','\0'} est un NTMBS contenant la chaîne « 你好 » en encodage UTF-8 multi-octets : les trois premiers octets codent le caractère « 你 », les trois octets suivants encodent le caractère « 好 ». La même chaîne codée en GB18030 est le tableau de caractères {'\xc4', '\xe3', '\xba', '\xc3', '\0'}, où chacun des deux caractères est codé en tant que séquence de deux octets.
Dans certains encodages multi-octets, une séquence de caractères multi-octets donnée peut représenter des caractères différents selon la séquence d'octets précédents, appelée « séquence de décalage ». Ce type d'encodage est connu comme dépendant de l'état : la connaissance de l'état de décalage courant est nécessaire pour interpréter chaque caractère. Une NTMBS n'est alors valide que si elle commence et se termine dans l'état initial : si une séquence de décalage a été utilisée, la séquence de décalage inverse correspondante doit être présente avant le caractère nul final. Des exemples de ces codages sont les JIS 7-bits, BOCU-1 et SCSU.
Une chaîne de caractères multi-octets est compatible avec la disposition chaîne d'octets terminée par NULL (NTBS), c'est-à-dire peut être stockée, copiée, et manpulée en utilisant les mêmes opérations, sauf pour le calcul du nombre de caractères. Si les paramètres régionaux corrects sont en vigueur, les fonctions d'entrée/sortie gèrent les chaînes multi-octets. Les chaînes multi-octets peuvent être converties en des chaînes étendues à l'aide des fonctions membres, std::codecvt, std::wstring_convert, ou les fonctions suivantes de conversion dépendant des paramètres régionaux :
[modifier] Multi-octets / conversions de caractères larges
Defined in header
<cstdlib> | |
renvoie le nombre d'octets dans le prochain caractère multi-octets Original: returns the number of bytes in the next multibyte character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
convertit le caractère multi-octets suivante de caractères larges Original: converts the next multibyte character to wide character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
convertit le caractère large de sa représentation multi-octets Original: converts a wide character to its multibyte representation The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
convertit une chaîne de caractères multi-octets en une chaîne de caractère étroit de large Original: converts a narrow multibyte character string to wide string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
convertit une chaîne large pour réduire chaîne de caractères multi-octets Original: converts a wide string to narrow multibyte character string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
Defined in header
<cwchar> | |
Vérifie si l'objet mbstate_t représente état initial Original: checks if the mbstate_t object represents initial shift state The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
élargit un caractère simple octet étroite pour les caractères larges, si possible Original: widens a single-byte narrow character to wide character, if possible The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
rétrécit un caractère large à un caractère sur un octet étroit, si possible Original: narrows a wide character to a single-byte narrow character, if possible The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
renvoie le nombre d'octets dans le prochain caractère multi-octets, état donné Original: returns the number of bytes in the next multibyte character, given state The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
convertit le caractère multi-octets suivante caractère large, état donné Original: converts the next multibyte character to wide character, given state The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
convertit le caractère large de sa représentation multi-octets, état donné Original: converts a wide character to its multibyte representation, given state The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
convertit une chaîne de caractères multi-octets en une chaîne de caractère étroit de large, état donné Original: converts a narrow multibyte character string to wide string, given state The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
convertit une chaîne large de chaîne de caractères multi-octets étroite, état donné Original: converts a wide string to narrow multibyte character string, given state The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
Defined in header
<cuchar> | |
(C++11) |
générer le prochain 16-bits pour les caractères larges partir d'une chaîne multi-octets étroite Original: generate the next 16-bit wide character from a narrow multibyte string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
(C++11) |
convertir un caractère large de 16 bits pour affiner chaîne multi-octets Original: convert a 16-bit wide character to narrow multibyte string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
(C++11) |
générer le prochain 32-bit caractère large depuis une chaîne multi étroite Original: generate the next 32-bit wide character from a narrow multibyte string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
(C++11) |
convertir un caractère de 32 bits de large pour réduire chaîne multi-octets Original: convert a 32-bit wide character to narrow multibyte string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) |
[modifier] Types
Defined in header
<cwchar> | |
informations sur l'état de conversion nécessaire pour parcourir les chaînes de caractères multi-octets Original: conversion state information necessary to iterate multibyte character strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |
[modifier] Macros
Defined in header
<climits> | |
MB_LEN_MAX |
nombre maximal d'octets dans un caractère multi-octets Original: maximum number of bytes in a multibyte character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (constante macro) |
Defined in header
<cstdlib> | |
MB_CUR_MAX |
nombre maximal d'octets dans un caractère multi-octets dans le courant C locale
( variable de macro ) Original: macro variable The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. Original: maximum number of bytes in a multibyte character in the current C locale ( variable de macro ) Original: macro variable The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Defined in header
<cuchar> | |
__STDC_UTF_16__ |
indique que l'encodage UTF-16 est utilisé par mbrtoc16 et c16rtomb (constante macro) |
__STDC_UTF_32__ |
indique que l'encodage UTF-32 est utilisé par mbrtoc32 et c32rtomb (constante macro) |