------- Comment #8 from ivranos at freemail dot gr  2008-09-30 09:51 -------
Note: Change the encoding of your browser and email client to Greek-ISO or
Unicode, so as to see the messages correctly.



locale -a displays the following:

[EMAIL PROTECTED]:~/Desktop/download/extract$ locale -a
C
el_CY.utf8
el_GR.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
POSIX
[EMAIL PROTECTED]:~/Desktop/download/extract$ 


==> Using these locales in the 3 of the 4 codes supplied, they work OK.


However the code number (3.) works only for "en_US.utf8", and it doesn't work
for "el_GR.utf8".


For "en_US.utf8":

#include <iostream>
#include <locale>
#include <string>


int main()
{
    using namespace std;

    wcin.imbue(locale("en_US.utf8"));
    wcout.imbue(locale("en_US.utf8"));

    wstring ws;

    wcin>> ws;

    wcout<< ws<< endl;
} 


[EMAIL PROTECTED]:~/Desktop/download/extract$ ./main
Test
Test
[EMAIL PROTECTED]:~/Desktop/download/extract$ 


For: "el_GR.utf8"

#include <iostream>
#include <locale>
#include <string>


int main()
{
    using namespace std;

    wcin.imbue(locale("el_GR.utf8"));
    wcout.imbue(locale("el_GR.utf8"));

    wstring ws;

    wcin>> ws;

    wcout<< ws<< endl;
} 


[EMAIL PROTECTED]:~/Desktop/download/extract$ ./main
&#916;&#959;&#954;&#953;&#956;&#945;&#963;&#964;&#953;&#954;&#972;

[EMAIL PROTECTED]:~/Desktop/download/extract$



As I said, the locales work in the 3 of the 4 codes supplied, but code number
(3.) doesn't.

So this isn't a "blocker" bug, but there is still a bug with wcin.imbue() and
wcout.imbue() when they are used alone without a 

"locale::global(locale("en_US"));"

or 

"ios_base::sync_with_stdio(false);"


statement.


wofstream works OK without any of the above statements.

For example the code:


#include <locale>
#include <string>
#include <fstream>


int main()
{
    using namespace std;

    wstring ws=
L"&#916;&#959;&#954;&#953;&#956;&#945;&#963;&#964;&#953;&#954;&#972;\n";

    wofstream file("filename.txt");

    file.imbue(locale("el_GR.utf8"));

   if(file.is_open())
      file<< ws;

}

works OK:

[EMAIL PROTECTED]:~/Desktop/download/extract$ g++ -ansi -pedantic-errors -Wall
main.cpp -o main
[EMAIL PROTECTED]:~/Desktop/download/extract$ cat filename.txt 
&#916;&#959;&#954;&#953;&#956;&#945;&#963;&#964;&#953;&#954;&#972;
[EMAIL PROTECTED]:~/Desktop/download/extract$ 


-- 

ivranos at freemail dot gr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|blocker                     |normal
             Status|RESOLVED                    |UNCONFIRMED
   GCC host triplet|                            |Ubuntu 8.04 x86
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37673

Reply via email to