* RE: Do wcout and wcin work with GCC?
@ 2003-09-02 17:43 lrtaylor
2003-09-02 19:55 ` Alex J. Dam
0 siblings, 1 reply; 4+ messages in thread
From: lrtaylor @ 2003-09-02 17:43 UTC (permalink / raw)
To: alexjotadam, gcc-help
What platform are you trying this on? Wide character support may depend on the platform as well as GCC.
Thanks,
Lyle Taylor
IS Applications
-----Original Message-----
From: Alex J. Dam [mailto:alexjotadam@yahoo.com.br]
Sent: Sunday, August 31, 2003 12:28 PM
To: gcc-help@gcc.gnu.org
Subject: Do wcout and wcin work with GCC?
Hi,
I would like to use C++ as my primary language for computer
programming, but I'm having some problems dealing with
multi-byte strings in g++.
How can I make wcin and wcout work? Whenever I read a string
from the console the string is truncated at the first non-ASCII
character. When I'm writing to wcout, the string is also
truncated.
I've tried imbue(), setlocale(), etc. but it didn't solve my
problem.
My locale is pt_BR.UTF-8, my gcc and g++ are version 3.3.1.
EXAMPLE:
#include <iostream>
#include <string>
#include <locale>
using namespace std;
int main(){
locale l("pt_BR.UTF-8");
setlocale(LC_ALL, "pt_BR.UTF-8");
locale::global(l);
wcout.imbue(l);
wcin.imbue(l);
wstring s;
wcin >> s;
wcout << s.length() << endl;
}
Some output:
$ ./prog
arboris
7
$ ./prog
árvore
0
Any help?
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Do wcout and wcin work with GCC?
2003-09-02 17:43 Do wcout and wcin work with GCC? lrtaylor
@ 2003-09-02 19:55 ` Alex J. Dam
2003-09-05 2:10 ` Alex J. Dam
0 siblings, 1 reply; 4+ messages in thread
From: Alex J. Dam @ 2003-09-02 19:55 UTC (permalink / raw)
To: lrtaylor, gcc-help
My system was built (mostly) according to LFS 4.0 on an AMD Athlon.
I don't know which packages' versions are relevant. My glibc is 2.2.5,
g++ is 3.3.1.
Alex
On Tue, 2 Sep 2003 11:43:04 -0600, <lrtaylor@micron.com> wrote:
> What platform are you trying this on? Wide character support may depend
> on the platform as well as GCC.
>
> Thanks,
> Lyle Taylor
> IS Applications
>
> -----Original Message-----
> From: Alex J. Dam [mailto:alexjotadam@yahoo.com.br]
> Sent: Sunday, August 31, 2003 12:28 PM
> To: gcc-help@gcc.gnu.org
> Subject: Do wcout and wcin work with GCC?
>
>
> Hi,
>
> I would like to use C++ as my primary language for computer
> programming, but I'm having some problems dealing with
> multi-byte strings in g++.
> How can I make wcin and wcout work? Whenever I read a string
> from the console the string is truncated at the first non-ASCII
> character. When I'm writing to wcout, the string is also
> truncated.
> I've tried imbue(), setlocale(), etc. but it didn't solve my
> problem.
> My locale is pt_BR.UTF-8, my gcc and g++ are version 3.3.1.
> EXAMPLE:
>
> #include <iostream>
> #include <string>
> #include <locale>
>
> using namespace std;
>
> int main(){
> locale l("pt_BR.UTF-8");
> setlocale(LC_ALL, "pt_BR.UTF-8");
> locale::global(l);
> wcout.imbue(l);
> wcin.imbue(l);
> wstring s;
> wcin >> s;
> wcout << s.length() << endl;
> }
>
> Some output:
> $ ./prog
> arboris
> 7
> $ ./prog
> árvore
> 0
>
> Any help?
>
> Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Do wcout and wcin work with GCC?
2003-09-02 19:55 ` Alex J. Dam
@ 2003-09-05 2:10 ` Alex J. Dam
0 siblings, 0 replies; 4+ messages in thread
From: Alex J. Dam @ 2003-09-05 2:10 UTC (permalink / raw)
To: lrtaylor, gcc-help
OK, you guys need not tell me why it's not working on my system.
I just wish to know whether it should work or if it's not working
only on my system.
thanks
Alex
On Tue, 02 Sep 2003 16:54:20 -0300, Alex J. Dam <alexjotadam@yahoo.com.br>
wrote:
>
> My system was built (mostly) according to LFS 4.0 on an AMD Athlon.
> I don't know which packages' versions are relevant. My glibc is 2.2.5,
> g++ is 3.3.1.
>
> Alex
>
> On Tue, 2 Sep 2003 11:43:04 -0600, <lrtaylor@micron.com> wrote:
>
>> What platform are you trying this on? Wide character support may
>> depend on the platform as well as GCC.
>>
>> Thanks,
>> Lyle Taylor
>> IS Applications
>>
>> -----Original Message-----
>> From: Alex J. Dam [mailto:alexjotadam@yahoo.com.br]
>> Sent: Sunday, August 31, 2003 12:28 PM
>> To: gcc-help@gcc.gnu.org
>> Subject: Do wcout and wcin work with GCC?
>>
>>
>> Hi,
>>
>> I would like to use C++ as my primary language for computer
>> programming, but I'm having some problems dealing with
>> multi-byte strings in g++.
>> How can I make wcin and wcout work? Whenever I read a string
>> from the console the string is truncated at the first non-ASCII
>> character. When I'm writing to wcout, the string is also
>> truncated.
>> I've tried imbue(), setlocale(), etc. but it didn't solve my
>> problem.
>> My locale is pt_BR.UTF-8, my gcc and g++ are version 3.3.1.
>> EXAMPLE:
>>
>> #include <iostream>
>> #include <string>
>> #include <locale>
>>
>> using namespace std;
>>
>> int main(){
>> locale l("pt_BR.UTF-8");
>> setlocale(LC_ALL, "pt_BR.UTF-8");
>> locale::global(l);
>> wcout.imbue(l);
>> wcin.imbue(l);
>> wstring s;
>> wcin >> s;
>> wcout << s.length() << endl;
>> }
>>
>> Some output:
>> $ ./prog
>> arboris
>> 7
>> $ ./prog
>> árvore
>> 0
>>
>> Any help?
>>
>> Alex
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Do wcout and wcin work with GCC?
@ 2003-08-31 18:28 Alex J. Dam
0 siblings, 0 replies; 4+ messages in thread
From: Alex J. Dam @ 2003-08-31 18:28 UTC (permalink / raw)
To: gcc-help
Hi,
I would like to use C++ as my primary language for computer
programming, but I'm having some problems dealing with
multi-byte strings in g++.
How can I make wcin and wcout work? Whenever I read a string
from the console the string is truncated at the first non-ASCII
character. When I'm writing to wcout, the string is also
truncated.
I've tried imbue(), setlocale(), etc. but it didn't solve my
problem.
My locale is pt_BR.UTF-8, my gcc and g++ are version 3.3.1.
EXAMPLE:
#include <iostream>
#include <string>
#include <locale>
using namespace std;
int main(){
locale l("pt_BR.UTF-8");
setlocale(LC_ALL, "pt_BR.UTF-8");
locale::global(l);
wcout.imbue(l);
wcin.imbue(l);
wstring s;
wcin >> s;
wcout << s.length() << endl;
}
Some output:
$ ./prog
arboris
7
$ ./prog
árvore
0
Any help?
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-09-05 2:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-02 17:43 Do wcout and wcin work with GCC? lrtaylor
2003-09-02 19:55 ` Alex J. Dam
2003-09-05 2:10 ` Alex J. Dam
-- strict thread matches above, loose matches on Subject: below --
2003-08-31 18:28 Alex J. Dam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).