wchar_t on Solaris 8
Christina Wang
cxwang_wt@hotmail.com
Tue Apr 15 17:51:00 GMT 2003
Hi,
Thanks for the reply. The only reason that I want to try encoding with EUC
is that on Solaris, the wide character conversion function "mbstowcs()"
converts a character string to wchar_t string with EUC encoding no matter
what the locale is. If we want to compare the returned wide character from
this function with a literal wide character, we will get the wrong result.
This is shown in the following example:
~~~~~~~~
wchar_t wcsbuf[256];
memset(wcsbuf, 0, sizeof(wcsbuf));
size_t wcslen = mbstowcs(wcsbuf, "\300\301\302\303\304\305\306\307",8);
wcsbuf[wcslen] = L'\0';
for (int j = 0; j < wcslen; j++) {
wchar_t wc = wcsbuf[j];
if (wc == L'\307')
.........
}
........
Any suggestions?
Thanks,
Christina
>From: "L. Nicoara" <nicoara@roguewave.com>
>To: Christina Wang <cxwang_wt@hotmail.com>
>CC: libstdc++@gcc.gnu.org
>Subject: Re: wchar_t on Solaris 8
>Date: Tue, 15 Apr 2003 10:31:37 -0600
>
>The only locales that I know to use EUC encoding are the asian locales:
>japanese, korean, etc.
>
>Why would you want to encode an arbitrary locale with EUC? IIRC
>correctly the charmaps shipped with glibc contain the EUC charmaps but
>they are tailored to specific asian locales (i.e. EUC-JP, EUC-TW,
>EUC-KR) and they may or may not be suitable for encoding an arbitrary
>locale (say english, spanish, etc.).
>
>Also, you may be confused about external vs. internal representation
>(encoding) of characters. EUC is an external encoding, whereas [for
>glibc] UCS4 is the internal encoding [for all locales regardless the
>external encoding].
>
>Liviu
>
>Christina Wang wrote:
> >
> >
> > Hi,
> >
> > Thanks for the reply. It seems that the internal representation of
>wchar_t
> > in gcc is unicode, do we have any way(compiler option etc.) to force it
>to
> > be EUC encoded?
> >
> > Thanks,
> > Christina
> >
> >
> >
> >
> >>From: "L. Nicoara" <nicoara@roguewave.com>
> >>To: Christina Wang <cxwang_wt@hotmail.com>
> >>CC: libstdc++@gcc.gnu.org
> >>Subject: Re: wchar_t on Solaris 8
> >>Date: Mon, 14 Apr 2003 16:59:59 -0600
> >>
> >>IIRC, on Solaris, the native libc uses locale dependent encoding.
> >>
> >>Liviu
> >>
> >>Christina Wang wrote:
> >> >
> >> > Hi,
> >> >
> >> > I got several questions about whar_t on Solaris. What's the encoding
>of
> >> > wchar_t on Solaris 8? Is it locale dependant or is it always EUC?
>What's
> >>the
> >> > encoding of whar_t in gcc3.2? Is it always Unicode?
> >> >
> >> > Thank you!
> >> >
> >> > Christina
> >> >
> >> >
> >> >
> >> > _________________________________________________________________
> >> > MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> >> > http://join.msn.com/?page=features/virus
> >> >
> >>
> >
> >
> > _________________________________________________________________
> > Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
> >
>
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
More information about the Libstdc++
mailing list