Tuesday, 15 June 2010

c++ - How to convert ANSI byte to Unicode string? -



c++ - How to convert ANSI byte to Unicode string? -

i have vector<byte> represents characters in string. want interpret characters ascii characters , store them in unicode (utf-16) string. current code assumes characters in vector<byte> unicode rather ascii. works fine standard ascii, fails extended ascii characters. these characters need interpreted using current code page retrieved via getacp(). how go creating unicode (utf-16) string these ascii characters?

edit: believe solution should have macros discussed here: http://msdn.microsoft.com/en-us/library/87zae4a3(v=vs.80).aspx i'm not sure how actual implementation go.

int extractbytearray(catlstring* pszresult, const cbytevector* pabdata) { // place info output cstring pszresult->empty(); for(int iindex = 0; iindex < pabdata->getsize(); iindex++) *pszresult += (tchar)pabdata->getat(iindex); homecoming rc_success; }

you should utilize multibytetowidechar convert string unicode

c++ visual-c++ mfc atl

No comments:

Post a Comment