Archived

This forum has been archived. Please start a new discussion on GitHub.

Is this a bug? (Wide char)

The following two code segments can not run correctly, whether it is a bug of ICE?
How to...?

My EMail: wynner@126.com
====================================

......
......

#include <conio.h>
#include <iostream>
#include <string>
#include <comdef.h>

using namespace std;

......
......

int _tmain(int argc, _TCHAR* argv[])
{
wstring s = L"W0:<####>"; //"####" is chinese word (wide char), can not be display
wcout << s << endl;
wcout << L"W1:<####>" << endl; //"####" is chinese word(wide char) can not be display

_bstr_t bstr = "W2:<####>";
cout << (LPCTSTR)bstr << endl;
getch();
return 0;
}
......
......

====================================



......
......

#include <conio.h>
#include <iostream>
#include <string>
#include <comdef.h>

using namespace std;

int main(int argc, char* argv[])
{
wstring s = L"W0:<简体汉字>";
wcout << s << endl;

wcout << L"W1:<简体汉字>" << endl;

_bstr_t bstr = "W2:<简体汉字>";

cout << (LPCTSTR)bstr << endl;
getch();

return 0;
}

......
......

Comments

  • benoit
    benoit Rennes, France
    Welcome to the forums! Please see [thread=1697]this thread[/thread] for information on our support policy. Could you also provide more information about your problem? I don't see how your question is related to Ice for instance.

    Thanks,

    Benoit.
  • hi,
    So far as your codes, no Ice is involved at all. It is none of ice's business:) .
    To display the 汉字, fellowing codes may be helpful:

    ........
    std::wcout.imbue(std::locale("chs"));
    std::wcout<< L"宽字符 " <<std::endl;
    ........

    When Ice is introduced , consider using the IceUtil::stringToWstring()
    function to translate the UTF8 to UTF16 .

    Finally, remember to edit your signature to get the helps from ICE guys. They are the actual specialists :) .

    Cheers
    OrNot
  • These code exist in a project base on ICE, and the two code segments can not run correctly after ICE was installed.
    now, I am not sure whether ICE cause this problem or not, so, I need you to help me.

    Thanks
  • matthew
    matthew NL, Canada
    As Benoit said, if you want us to help you please fill out your signature information as described in the post that he quoted.