utf8.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef fooutf8hfoo
  2. #define fooutf8hfoo
  3. /***
  4. This file is part of PulseAudio.
  5. Copyright 2006 Lennart Poettering
  6. Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
  7. PulseAudio is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU Lesser General Public License as
  9. published by the Free Software Foundation; either version 2.1 of the
  10. License, or (at your option) any later version.
  11. PulseAudio is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
  17. ***/
  18. #include <pulse/cdecl.h>
  19. #include <pulse/gccmacro.h>
  20. #include <pulse/version.h>
  21. /** \file
  22. * UTF-8 validation functions
  23. */
  24. PA_C_DECL_BEGIN
  25. /** Test if the specified strings qualifies as valid UTF8. Return the string if so, otherwise NULL */
  26. char *pa_utf8_valid(const char *str) PA_GCC_PURE;
  27. /** Test if the specified strings qualifies as valid 7-bit ASCII. Return the string if so, otherwise NULL. \since 0.9.15 */
  28. char *pa_ascii_valid(const char *str) PA_GCC_PURE;
  29. /** Filter all invalid UTF8 characters from the specified string, returning a new fully UTF8 valid string. Don't forget to free the returned string with pa_xfree() */
  30. char *pa_utf8_filter(const char *str);
  31. /** Filter all invalid ASCII characters from the specified string, returning a new fully ASCII valid string. Don't forget to free the returned string with pa_xfree(). \since 0.9.15 */
  32. char *pa_ascii_filter(const char *str);
  33. /** Convert a UTF-8 string to the current locale. Free the string using pa_xfree(). */
  34. char* pa_utf8_to_locale (const char *str);
  35. /** Convert a string in the current locale to UTF-8. Free the string using pa_xfree(). */
  36. char* pa_locale_to_utf8 (const char *str);
  37. PA_C_DECL_END
  38. #endif