|
Wireshark 4.7.3
The Wireshark network protocol analyzer
|
#include <wireshark.h>Go to the source code of this file.
Macros | |
| #define | DEBUG_UTF_8_ENABLED false |
| #define | _CHECK_UTF_8(level, str, len) |
| #define | WS_UTF_8_CHECK(str, len) |
| #define | WS_UTF_8_DEBUG_HERE(str, len) |
| #define | ws_utf8_char_len(ch) |
| Returns the length of a UTF-8 multibyte sequence from its first byte. | |
| #define | IS_LEAD_SURROGATE(uchar2) |
| #define | IS_TRAIL_SURROGATE(uchar2) |
| #define | SURROGATE_VALUE(lead, trail) |
Functions | |
| WS_DLL_PUBLIC uint8_t * | ws_utf8_make_valid (wmem_allocator_t *scope, const uint8_t *ptr, ssize_t length) |
| Validates and sanitizes a UTF-8 byte sequence. | |
| WS_DLL_PUBLIC wmem_strbuf_t * | ws_utf8_make_valid_strbuf (wmem_allocator_t *scope, const uint8_t *ptr, ssize_t length) |
| Validates a UTF-8 byte sequence and returns a string buffer. | |
Variables | |
| WSUTIL_EXPORT const int | ws_utf8_seqlen [256] |
Unicode convenience routines.
| #define _CHECK_UTF_8 | ( | level, | |
| str, | |||
| len ) |
| #define IS_LEAD_SURROGATE | ( | uchar2 | ) |
| #define IS_TRAIL_SURROGATE | ( | uchar2 | ) |
| #define SURROGATE_VALUE | ( | lead, | |
| trail ) |
| #define ws_utf8_char_len | ( | ch | ) |
Returns the length of a UTF-8 multibyte sequence from its first byte.
Determines the expected number of bytes in a UTF-8 encoded code point based on the leading byte. Returns 0 if the byte is invalid as a UTF-8 starter.
| ch | The first byte of a UTF-8 sequence. |
| #define WS_UTF_8_CHECK | ( | str, | |
| len ) |
| #define WS_UTF_8_DEBUG_HERE | ( | str, | |
| len ) |
| WS_DLL_PUBLIC uint8_t * ws_utf8_make_valid | ( | wmem_allocator_t * | scope, |
| const uint8_t * | ptr, | ||
| ssize_t | length ) |
Validates and sanitizes a UTF-8 byte sequence.
Processes a raw byte string of length length, replacing any ill-formed UTF-8 sequences with the Unicode REPLACEMENT CHARACTER (U+FFFD). The result is allocated using the provided Wireshark Memory Manager scope.
| scope | Memory allocator scope for the returned string. |
| ptr | Pointer to the input byte sequence. |
| length | Length of the input sequence. |
| WS_DLL_PUBLIC wmem_strbuf_t * ws_utf8_make_valid_strbuf | ( | wmem_allocator_t * | scope, |
| const uint8_t * | ptr, | ||
| ssize_t | length ) |
Validates a UTF-8 byte sequence and returns a string buffer.
Similar to ws_utf8_make_valid(), but returns a wmem_strbuf_t object for easier manipulation and appending. Ill-formed sequences are replaced with the Unicode REPLACEMENT CHARACTER.
| scope | Memory allocator scope for the returned buffer. |
| ptr | Pointer to the input byte sequence. |
| length | Length of the input sequence. |