MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

Functions
UTF8.hxx File Reference
`#include "Compiler.h"`
`#include <stddef.h>`
Include dependency graph for UTF8.hxx:

Go to the source code of this file.

## Functions
gcc_pure gcc_nonnull_all bool | ValidateUTF8 (const char *p)
| Is this a valid UTF-8 string? More...
gcc_const size_t | SequenceLengthUTF8 (char ch)
gcc_pure size_t | SequenceLengthUTF8 (const char *p)
gcc_pure gcc_nonnull_all const char * | Latin1ToUTF8 (const char *src, char *buffer, size_t buffer_size)
| Convert the specified string from ISO-8859-1 to UTF-8. More...
gcc_nonnull_all char * | UnicodeToUTF8 (unsigned ch, char *buffer)
| Convert the specified Unicode character to UTF-8 and write it to the buffer. More...
gcc_pure gcc_nonnull_all size_t | LengthUTF8 (const char *p)
| Returns the number of characters in the string. More...

## Function Documentation

gcc_pure gcc_nonnull_all const char* Latin1ToUTF8 | ( | const char * | src,
|  | char * | buffer,
|  | size_t | buffer_size
| ) |  |

Convert the specified string from ISO-8859-1 to UTF-8.

Returns
  the UTF-8 version of the source string; may return #src if there are no non-ASCII characters; returns nullptr if the destination buffer is too small

gcc_pure gcc_nonnull_all size_t LengthUTF8 | ( | const char * | p | ) |

Returns the number of characters in the string.

This is different from strlen(), which counts the number of bytes.

gcc_const size_t SequenceLengthUTF8 | ( | char | ch | ) |

Returns
  the number of the sequence beginning with the given character, or 0 if the character is not a valid start byte

gcc_pure size_t SequenceLengthUTF8 | ( | const char * | p | ) |

Returns
  the number of the first sequence in the given string, or 0 if the sequence is malformed

gcc_nonnull_all char* UnicodeToUTF8 | ( | unsigned | ch,
|  | char * | buffer
| ) |  |

Convert the specified Unicode character to UTF-8 and write it to the buffer.

buffer must have a length of at least 6!

Returns
  a pointer to the buffer plus the added bytes(s)

gcc_pure gcc_nonnull_all bool ValidateUTF8 | ( | const char * | p | ) |

Is this a valid UTF-8 string?