Boost logo

Boost Users :

Subject: Re: [Boost-users] wchar_t and boost::asio
From: Eric MALENFANT (Eric.Malenfant_at_[hidden])
Date: 2009-02-19 10:05:04


Igor R:
> Cain Miley:
>> Okay, i sorted out that you can't use
>> boost::asio::basic_streambuf with wide chars, but if not
>> that, how do I send wide chars with asio?
>>
>> Is it even possible?
>
>
>
> Afterall, wide char is just sequence of two chars, isn't it?

Not necessarily. It is platform-dependent. And even on two platforms
where sizeof(wchar_t) would be equal, the issue of the encoding still
remains.

To transmit "wide" chars as a sequence of bytes, you have to take care
of the various possible encodings by either:
- Choosing one and only one (UTF-8 comes to mind) and convert between
this encoding and whatever you want your wide chars to be encoded
- Having a mechanism that the peers can use to communicate, and possibly
negotiate, the encoding to use.

(And I'd advise the first, the second makes things rather complex)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net