1234567891011121314151617181920212223242526272829 |
- #include "language.h"
- #include "strnormalize.h"
- #include "unicode.h"
- #include <string.h>
- char Utf8ToGbkOrUnicode(char *ibuf, int inlen,char *outbuf, int *outlen, char codetype){
- int outsize=*outlen;
- if(0>utf8_to_gbk(ibuf, inlen, outbuf, outlen)) return 1;
- if(0!=codetype){
- memcpy(ibuf, outbuf,*outlen);
- *outlen=2*Ansi_to_Unicode((uint16_t *)outbuf, outsize/2,ibuf, *outlen);
- }
- return 0;
- }
- void gbkToUnicode(char *inbuf, int inlen, char *outbuf, int *outlen){
- *outlen=Ansi_to_Unicode((uint16_t *)outbuf, *outlen/2,inbuf, inlen);
- }
- void unicodeToGbk(const char *inbuf, unsigned char *outbuf, unsigned short *outlen){
- *outlen=StrUnicodeToAnsi(outbuf, *outlen, inbuf);
- }
|