charset.h 851 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef TOOLKIT_CHARACHER_SET_H__
  2. #define TOOLKIT_CHARACHER_SET_H__
  3. #pragma once
  4. #include "config.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. typedef
  9. enum char_encoding_enu {
  10. unknown, ansi, unicode, unicode_with_big_endian, unicode_with_bom, unicode_without_bom
  11. } char_encoding;
  12. TOOLKIT_API int toolkit_utf82gbk(char* inbuf, size_t inlen, char* outbuf, size_t outlen);
  13. TOOLKIT_API int toolkit_gbk2utf8(char* inbuf, size_t inlen, char* outbuf, size_t outlen);
  14. /*0: not-utf8, 1: utf-8: -1: analyze failed*/
  15. TOOLKIT_API int toolkit_detect_utf8_file(const char* file_path);
  16. //test now
  17. TOOLKIT_API char_encoding detect_file_encoding(const char* file_path);
  18. TOOLKIT_API int toolkit_detect_utf8_str(const char* str);
  19. #ifdef __cplusplus
  20. } // extern "C" {
  21. #endif
  22. #endif //TOOLKIT_CHARACHER_SET_H__