Null-terminated multibyte strings
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Нулем многобайтовую строку (NTMBS), или "многобайтовую строку", представляет собой последовательность ненулевых байт за которым следует байт с нулевым значением (пустой символ завершения).
Original:
A null-terminated multibyte string (NTMBS), or "multibyte string", is a sequence of nonzero bytes followed by a byte with value zero (the terminating null character).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Каждый символ хранится в строке может занимать более одного байта. Кодировка, используемая для представления символов в строку многобайтовых символов является локалей: это может быть UTF-8, GB18030, EUC-JP, Shift-JIS и др. Например, массив символов {'\xe4','\xbd','\xa0','\xe5','\xa5','\xbd','\0'} является NTMBS проведения строку "你好" В UTF-8 кодировок: первые три байта кодирования символов 你, следующие три байта кодирования символов 好. То же строку, закодированную в GB18030 это символ {'\xc4', '\xe3', '\xba', '\xc3', '\0' массива}, где каждое из двух символов кодируется как два байта последовательности.
Original:
Each character stored in the string may occupy more than one byte. The encoding used to represent characters in a multibyte character string is locale-specific: it may be UTF-8, GB18030, EUC-JP, Shift-JIS, etc. For example, the char array {'\xe4','\xbd','\xa0','\xe5','\xa5','\xbd','\0'} is an NTMBS holding the string "你好" in UTF-8 multibyte encoding: the first three bytes encode the character 你, the next three bytes encode the character 好. The same string encoded in GB18030 is the char array {'\xc4', '\xe3', '\xba', '\xc3', '\0'}, where each of the two characters is encoded as a two-byte sequence.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
В некоторых многобайтовых кодировок, любой заданной последовательности многобайтовые характера могут представлять различные символы в зависимости от предыдущей последовательности байтов, известный как "сдвиг последовательности". Такие кодировки называются зависящих от состояния: знания о текущем состоянии смены обязан толковать каждый символ. NTMBS действительна только если оно начинается и заканчивается в начальном состоянии сдвига: если сдвиг последовательности была использована, соответствующая последовательность Отменить замену должен присутствовать перед завершающий нулевой символ. Примеры такой кодировки 7-битный JIS, BOCU-1 и ГТСУ.
Original:
In some multibyte encodings, any given multibyte character sequence may represent different characters depending on the previous byte sequences, known as "shift sequences". Such encodings are known as state-dependent: knowledge of the current shift state is required to interpret each character. An NTMBS is only valid if it begins and ends in the initial shift state: if a shift sequence was used, the corresponding unshift sequence has to be present before the terminating null character. Examples of such encodings are the 7-bit JIS, BOCU-1 and SCSU.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Многобайтовой строки символов является макет совместим с нулевым байтом строки (НТБ), которые могут быть сохранены, скопированы и изучены с помощью того же средства, за исключением подсчета количества символов. Если правильный язык, по сути, функции ввода / вывода и обработки многобайтовых строк. Multibyte строки могут быть преобразованы в и из широких строк с использованием std::codecvt функции-члены, std::wstring_convert, или на следующий локали-зависимых функций преобразования:
Original:
A multibyte character string is layout-compatible with null-terminated byte string (NTBS), that is, can be stored, copied, and examined using the same facilities, except for calculating the number of characters. If the correct locale is in effect, I/O functions also handle multibyte strings. Multibyte strings can be converted to and from wide strings using the std::codecvt member functions, std::wstring_convert, or the following locale-dependent conversion functions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] Многобайтовых / широкий преобразования характера
| Определено в файле <cstdlib>
| |
| возвращает количество байтов в следующий символ многобайтовых 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. (функция) | |
| преобразует следующий символ многобайтовых широкого характера 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. (функция) | |
| преобразует широкий символ в своем многобайтовых представление 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. (функция) | |
| преобразует узкой буквенная многобайтовых широкой строки 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. (функция) | |
| Преобразует строку широких, чтобы сузить многобайтовой строки символов 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. (функция) | |
| Определено в файле <cwchar>
| |
| проверяет, является ли mbstate_t объект представляет начальное состояние смену 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. (функция) | |
| расширяется однобайтовые узкий характер широкого характера, если это возможно 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. (функция) | |
| сужает широкий характер однобайтовые узкий характер, если это возможно 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. (функция) | |
| возвращает количество байтов в следующем многобайтового символа, данное состояние 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. (функция) | |
| преобразует следующий символ многобайтовых широкого характера, данное состояние 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. (функция) | |
| преобразует широкий символ в своем многобайтовых представление, данное состояние 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. (функция) | |
| преобразует узкой буквенная многобайтовых широкой строки, данное состояние 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. (функция) | |
| Преобразует строку широких к узким многобайтовой строки символов, данное состояние 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. (функция) | |
| Определено в файле <cuchar>
| |
| (C++11) |
генерации следующего 16-битный символ из узких строку многобайтовых 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. (функция) |
| (C++11) |
Преобразование 16-битного широкий характер, чтобы сузить многобайтовую строку 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. (функция) |
| (C++11) |
генерации следующего 32-битный символ из узких строку многобайтовых 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. (функция) |
| (C++11) |
Преобразование 32-битного широкий характер, чтобы сузить многобайтовую строку 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. (функция) |
[править] Типы
| Определено в файле <cwchar>
| |
| Преобразование информации о состоянии необходимой для перебора многобайтовые строки символов 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. (класс) | |
[править] Макросы
| Определено в файле <climits>
| |
| MB_LEN_MAX |
Максимальное число байтов в многобайтовых символов 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. (константа-макрос) |
| Определено в файле <cstdlib>
| |
| MB_CUR_MAX |
Максимальное число байтов в многобайтовых символов в текущем C locale
(макропеременной) Original: maximum number of bytes in a multibyte character in the current C locale (макропеременной) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| Определено в файле <cuchar>
| |
| __STDC_UTF_16__ |
указывает, что UTF-16 используется кодировка по mbrtoc16 и c16rtomb Original: indicates that UTF-16 encoding is used by mbrtoc16 and c16rtomb The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (константа-макрос) |
| __STDC_UTF_32__ |
указывает, что UTF-32 используется кодировка по mbrtoc32 и c32rtomb Original: indicates that UTF-32 encoding is used by mbrtoc32 and c32rtomb The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (константа-макрос) |