508{
509#if !defined (STLPORT) || (!defined (_STLP_NO_WCHAR_T) && defined (_STLP_USE_EXCEPTIONS))
510 {
516 const char *from_next;
517 wchar_t wc;
518 wchar_t *to_next;
524 }
525 try
526 {
527 wstring cp936_wstr;
528 const string cp936_str = "\xd6\xd0\xb9\xfa\xc9\xe7\xbb\xe1\xbf\xc6\xd1\xa7\xd4\xba\xb7\xa2\xb2\xbc\x32\x30\x30\x38\xc4\xea\xa1\xb6\xbe\xad\xbc\xc3\xc0\xb6\xc6\xa4\xca\xe9\xa1\xb7\xd6\xb8\xb3\xf6\xa3\xac\x32\x30\x30\x37\xc4\xea\xd6\xd0\xb9\xfa\xbe\xad\xbc\xc3\xd4\xf6\xb3\xa4\xd3\xc9\xc6\xab\xbf\xec\xd7\xaa\xcf\xf2\xb9\xfd\xc8\xc8\xb5\xc4\xc7\xf7\xca\xc6\xc3\xf7\xcf\xd4\xd4\xa4\xbc\xc6\xc8\xab\xc4\xea\x47\x44\x50\xd4\xf6\xcb\xd9\xbd\xab\xb4\xef\x31\x31\x2e\x36\x25\xa1\xa3";
533
535
536 {
537 wchar_t wbuf[4096];
538
539 int len =
cvt.length(
state, cp936_str.
data(), cp936_str.
data() + cp936_str.
size(),
sizeof(wbuf) /
sizeof(
wchar_t));
541
542 const char *from_next;
543 wchar_t *to_next;
545 wbuf, wbuf + sizeof(wbuf) / sizeof(wchar_t), to_next);
548 cp936_wstr.assign(wbuf, to_next);
549 }
550
551 {
552 const wchar_t *from_next;
554 char *to_next;
555 res =
cvt.out(
state, cp936_wstr.data(), cp936_wstr.data() + cp936_wstr.size(), from_next,
559 }
560 }
562 {
563 CPPUNIT_MESSAGE(
"Not enough platform localization support to check 936 code page encoding.");
564 }
565 try
566 {
567 const string utf8_str = "\xe4\xb8\xad\xe5\x9b\xbd\xe7\xa4\xbe\xe4\xbc\x9a\xe7\xa7\x91\xe5\xad\xa6\xe9\x99\xa2\xe5\x8f\x91\xe5\xb8\x83\x32\x30\x30\x38\xe5\xb9\xb4\xe3\x80\x8a\xe7\xbb\x8f\xe6\xb5\x8e\xe8\x93\x9d\xe7\x9a\xae\xe4\xb9\xa6\xe3\x80\x8b\xe6\x8c\x87\xe5\x87\xba\xef\xbc\x8c\x32\x30\x30\x37\xe5\xb9\xb4\xe4\xb8\xad\xe5\x9b\xbd\xe7\xbb\x8f\xe6\xb5\x8e\xe5\xa2\x9e\xe9\x95\xbf\xe7\x94\xb1\xe5\x81\x8f\xe5\xbf\xab\xe8\xbd\xac\xe5\x90\x91\xe8\xbf\x87\xe7\x83\xad\xe7\x9a\x84\xe8\xb6\x8b\xe5\x8a\xbf\xe6\x98\x8e\xe6\x98\xbe\xe9\xa2\x84\xe8\xae\xa1\xe5\x85\xa8\xe5\xb9\xb4\x47\x44\x50\xe5\xa2\x9e\xe9\x80\x9f\xe5\xb0\x86\xe8\xbe\xbe\x31\x31\x2e\x36\x25\xe3\x80\x82";
568 wstring utf8_wstr;
573
575
576 {
577 wchar_t wbuf[4096];
578
579 int len =
cvt.length(
state, utf8_str.
data(), utf8_str.
data() + utf8_str.
size(),
sizeof(wbuf) /
sizeof(
wchar_t));
581
582 const char *from_next;
583 wchar_t *to_next;
585 wbuf, wbuf + sizeof(wbuf) / sizeof(wchar_t), to_next);
588 utf8_wstr.assign(wbuf, to_next);
589
590
591 wchar_t wc;
593 const char* from_end =
from + utf8_str.
size();
594 from_next = utf8_str.
data();
596 size_t windex = 0;
599 &wc, &wc + 1, to_next);
602
606 wc = 0;
607 break;
609 if (from_next ==
from)
610
612 else
613
614
616 continue;
620
621 }
622 }
624 }
625
626 {
627 const wchar_t *from_next;
629 char *to_next;
630 res =
cvt.out(
state, utf8_wstr.data(), utf8_wstr.data() + utf8_wstr.size(), from_next,
634 }
635
636 {
637
638 const string bad_utf8_str("\xdf\xdf\xdf\xdf\xdf");
639 wchar_t wc;
640 const char *from_next;
641 wchar_t *to_next;
642 res =
cvt.in(
state, bad_utf8_str.data(), bad_utf8_str.data() + bad_utf8_str.size(), from_next,
643 &wc, &wc + 1, to_next);
645 }
646 }
648 {
649 CPPUNIT_MESSAGE(
"Not enough platform localization support to check UTF8 encoding.");
650 }
651#endif
652}
const _CharT * data() const
static const locale &_STLP_CALL classic()
#define CPPUNIT_MESSAGE(m)
static char * cvt(double arg, int ndigits, int *decpt, int *sign, char *buf, int eflag)
GLuint GLsizei GLsizei * length