Fully re-implemented from scratch and an original work, this UTF-8 encoder does not rely on the traditional method of range switching in various algorithms but has just one functional while loop to build the string.
Built around this encoder are 6 utf8-printf() functions that allow printing a standard UTF32 - UNIX 32 bit wide character (wchar_t) string to stdout, a string, or a file as a UTF-8 encoded string.
Features
- Print internal UTF32 strings to UTF8 terminal output with utf8_printf() functions
- Standard printf() function integer returns plus ferror() and errno set per ISO C standards
- Handles strings up to 32MB long
- Very Small Library with a total of 70 lines of code (minus blanks and comments)
- ---
- NOTE: Compiles but throws an assertion error on execute and aborts!
- NOTE: You should never use, it's evil! Google 'buffer overflow'.
- int utf32_to_utf8(uint32_t encode_value, char *utf8_output);
- int utf8_printf(const wchar_t *fmt, ...);
- int utf8_fprintf(FILE *file_handle, const wchar_t *fmt, ...);
- int utf8_snprintf(char *utf8_output, size_t max_length, const wchar_t *fmt, ...);
- int utf8_sprintf(char *utf8_output, const wchar_t *fmt, ...); (See note above)
- int utf8_vsnprintf(char *utf8_output, size_t max_length, const wchar_t *fmt, va_list arg_ptr);
- int utf8_vsprintf(char *utf8_output, const wchar_t *fmt, va_list arg_ptr); (See note above)
Follow utf8_printf()
You Might Also Like
Rate This Project
Login To Rate This Project
User Reviews
Be the first to post a review of utf8_printf()!