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)

Project Activity

See All Activity >

Follow utf8_printf()

utf8_printf() Web Site

Other Useful Business Software
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of utf8_printf()!

Additional Project Details

Registered

2014-04-21