Ejemplo n.º 1
0
UINT oemtext_utf8tosjis(char *dst, UINT dcnt, const char *src, UINT scnt) {

    UINT	leng;
    UINT16	*ucs2;
    UINT	ret;

    (void)scnt;

    leng = codecnv_utf8toucs2(NULL, 0, src, scnt);
    if (leng == 0) {
        return(0);
    }
    ucs2 = (UINT16 *)_MALLOC(leng * sizeof(UINT16), "");
    if (ucs2 == NULL) {
        return(0);
    }
    codecnv_utf8toucs2(ucs2, leng, src, scnt);
    if (((SINT)scnt) < 0) {
        leng = (UINT)-1;
    }
    ret = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)ucs2, leng, dst, dcnt, NULL, NULL);
    _MFREE(ucs2);
    return(ret);
}
Ejemplo n.º 2
0
UINT oemtext_utf8tomb(UINT cp, char *dst, UINT dcnt, const char *src, UINT scnt) {

	UINT	leng;
	wchar_t	*ucs2;
	UINT	ret;

	(void)scnt;

	leng = codecnv_utf8toucs2(NULL, 0, src, scnt);
	if (leng == 0) {
		return(0);
	}
	ucs2 = (wchar_t *)_MALLOC(leng * sizeof(wchar_t), "");
	if (ucs2 == NULL) {
		return(0);
	}
	codecnv_utf8toucs2((UINT16 *)ucs2, leng, src, scnt);
	if (((SINT)scnt) < 0) {
		leng = (UINT)-1;
	}
	ret = WideCharToMultiByte(cp, 0, ucs2, leng, dst, dcnt, NULL, NULL);
	_MFREE(ucs2);
	return(ret);
}