FreeBSD Bugzilla – Attachment 243134 Details for
Bug 272293
The mbrtoc32 and mbrtoc16 functions don't recognize the same multibyte sequences as mbrtowc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test program using iconv directly
t272293.c (text/plain), 936 bytes, created by
John F. Carr
on 2023-07-02 14:18:33 UTC
(
hide
)
Description:
Test program using iconv directly
Filename:
MIME Type:
Creator:
John F. Carr
Created:
2023-07-02 14:18:33 UTC
Size:
936 bytes
patch
obsolete
>#include <iconv.h> >#include <stdio.h> > >int main(int argc, char *argv[]) >{ > iconv_t i; > size_t count, errors; > char src[4] = "\224\071\375\067"; > char dst[8]; > char *srcptr = src, *dstptr = dst; > size_t srcleft = sizeof src; > size_t dstleft = sizeof dst; > > if (1) > i = iconv_open("UTF-8", "GB18030"); > else > i = iconv_open("UCS-4-INTERNAL", "GB18030"); > if (i == (iconv_t)-1) { > perror("iconv_open"); > return 2; > } > > errors = iconv(i, &srcptr, &srcleft, &dstptr, &dstleft); > > if (errors == (size_t) -1) { > perror("iconv"); > return 3; > } > > if (errors > 0) > fprintf(stdout, "iconv = %zu; srcleft = %zu, dstleft = %zu\n", > errors, srcleft, dstleft); > > if (sizeof dst - dstleft == 4) > fprintf(stdout, "dst = %02x%02x%02x%02x\n", > dst[3] & 255, dst[2] & 255, dst[1] & 255, dst[0] & 255); > > if (iconv_close(i) == -1) { > perror("iconv_close"); > return 4; > } > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 272293
:
243081
| 243134