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
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
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