1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #ifndef TOOLKIT_CHARACHER_SET_H__
- #define TOOLKIT_CHARACHER_SET_H__
- #pragma once
- #include "config.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef
- enum char_encoding_enu {
- unknown, ansi, unicode, unicode_with_big_endian, unicode_with_bom, unicode_without_bom
- } char_encoding;
- TOOLKIT_API int toolkit_utf82gbk(char* inbuf, size_t inlen, char* outbuf, size_t outlen);
- TOOLKIT_API int toolkit_gbk2utf8(char* inbuf, size_t inlen, char* outbuf, size_t outlen);
- /*0: not-utf8, 1: utf-8: -1: analyze failed*/
- TOOLKIT_API int toolkit_detect_utf8_file(const char* file_path);
- //test now
- TOOLKIT_API char_encoding detect_file_encoding(const char* file_path);
- TOOLKIT_API int toolkit_detect_utf8_str(const char* str);
- /** from upgradetask [Gifur@2025725]*/
- //1:utf8;0:no utf8
- TOOLKIT_API int toolkit_detect_utf8_str2(const char* str);
- TOOLKIT_API size_t toolkit_mbs2wcs(const char* src, wchar_t* dst, size_t dst_size);
- TOOLKIT_API size_t toolkit_wcs2mbs(const wchar_t* src, char* dst, size_t dst_size);
- //only valid in win and the user remember to free the return if not null
- //return NULL input param directory in UOS, please use toolkit_utf82gbk if you need
- //copy from httpclient.h
- TOOLKIT_API char* ConvertUtf8ToGBK(const char* strUtf8);
- //only valid in win and the user remember to free the return if not null
- //return NULL directory in UOS, please use toolkit_gbk2utf8 if you need
- //copy from httpclient.h
- TOOLKIT_API char* ConvertGBKToUtf8(const char* gbk, int* n);
- #ifdef __cplusplus
- } // extern "C" {
- #endif
- #endif //TOOLKIT_CHARACHER_SET_H__
|