Re: cstring to cbytearray conversion
- From: Goran Pusic <goranp@xxxxxxxxxxxxxxxxx>
- Date: Thu, 2 Sep 2010 00:40:59 -0700 (PDT)
FWIW, I agree with David, for anything "internet", UTF-8 is a better
choice.
It's not hard: save/manipulate all your stuff in Unicode encoding
supported by the system (here: UTF-16LE). Convert to UTF-8 for that
final send over the wire. So just use CString with UNICODE (that is,
use CStringW), and, before you put it on the wire, use
WideCharToMultiByte(CP_UTF8, ...).
(
To do that easily, you'll probably decide that you need helpers like
these:
// Use WideCharToMultiByte(CP_UTF8, ...) here.
CStringA UTF8(const CStringW& src);
CStringA UTF8(LPCWSTR src);
CStringA UTF8(LPCWSTR src, int length);
)
Goran.
.
- References:
- Re: cstring to cbytearray conversion
- From: Goran Pusic
- Re: cstring to cbytearray conversion
- From: mfc
- Re: cstring to cbytearray conversion
- From: mfc
- Re: cstring to cbytearray conversion
- From: David Wilkinson
- Re: cstring to cbytearray conversion
- From: mfc
- Re: cstring to cbytearray conversion
- From: David Wilkinson
- Re: cstring to cbytearray conversion
- From: mfc
- Re: cstring to cbytearray conversion
- Prev by Date: Re: Change Check Box background color
- Next by Date: Re: OT? Any Suggestions on a graphics lib
- Previous by thread: Re: cstring to cbytearray conversion
- Next by thread: Re: cstring to cbytearray conversion
- Index(es):
Relevant Pages
|