Click here to Skip to main content
15,905,504 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMDI app without MFC? Pin
B2-Sep-00 3:52
B2-Sep-00 3:52 
AnswerRe: MDI app without MFC? Pin
jschacker5-Sep-00 5:17
jschacker5-Sep-00 5:17 
AnswerRe: MDI app without MFC? Pin
Sam Hobbs7-Sep-00 18:49
Sam Hobbs7-Sep-00 18:49 
AnswerRe: MDI app without MFC? Pin
Scott Leonard8-Sep-00 5:00
Scott Leonard8-Sep-00 5:00 
QuestionFunction for Converting a CString/char* to UTF-8? Pin
Uwe Keim1-Sep-00 9:56
sitebuilderUwe Keim1-Sep-00 9:56 
AnswerRe: Function for Converting a CString/char* to UTF-8? Pin
Michael Dunn1-Sep-00 20:10
sitebuilderMichael Dunn1-Sep-00 20:10 
GeneralRe: Function for Converting a CString/char* to UTF-8? Pin
Uwe Keim1-Sep-00 23:32
sitebuilderUwe Keim1-Sep-00 23:32 
GeneralSolution FOUND: Function for Converting a CString/char* to UTF-8? Pin
Uwe Keim2-Sep-00 1:24
sitebuilderUwe Keim2-Sep-00 1:24 
After mailing with Markus Kuhn, the author of www.cl.cam.ac.uk/~mgk25/, he told me the following solution (function 1), which I wrapped a little bit (function 2):

// Convert a Latin-1 string to UTF-8.
// from xterm sources.
// t: output, s: input, len: input length.
// returns length of output.
static int Latin1toUTF8(TCHAR *t, const TCHAR *s, int len)
{
    const TCHAR *p = s;
    TCHAR *q = t;
    while (p < s + len) {
        if ((*p & 0x80) == 0) {
            *q++ = *p++;
        } else {
            *q++ = 0xC0 | ((*p >> 6) & 0x3);
            *q++ = 0x80 | (*p & 0x3F);
            p++;
        }
    }
    return q - t;
}

// MFC-wrapper for Latin1toUTF8.
void StringToUTF8( const CString& input, CByteArray& output )
{
	output.RemoveAll();

	if ( input.IsEmpty() )
		return;

	output.SetSize(input.GetLength()*6);	// prepare for worst-case.
	const int new_length = Latin1toUTF8( (TCHAR*)output.GetData(), input, input.GetLength() );

	ASSERT(new_length<=output.GetLength());
	output.SetSize(new_length);
}


Thanks to Markus!
GeneralCComboBoxEx and LimitText Pin
David Saulnier1-Sep-00 8:49
David Saulnier1-Sep-00 8:49 
GeneralIDE and Windows 2000 Problems Pin
arf1-Sep-00 5:52
arf1-Sep-00 5:52 
GeneralRe: IDE and Windows 2000 Problems Pin
Paolo Messina1-Sep-00 10:01
professionalPaolo Messina1-Sep-00 10:01 
GeneralRe: IDE and Windows 2000 Problems Pin
David Wulff1-Sep-00 14:36
David Wulff1-Sep-00 14:36 
GeneralSorry for my spelling Pin
David Wulff1-Sep-00 14:38
David Wulff1-Sep-00 14:38 
GeneralRe: IDE and Windows 2000 Problems Pin
arf2-Sep-00 9:55
arf2-Sep-00 9:55 
GeneralRe: IDE and Windows 2000 Problems Pin
David Wulff2-Sep-00 11:11
David Wulff2-Sep-00 11:11 
GeneralRe: IDE and Windows 2000 Problems Pin
Ronald L. Russell Jr. (Ron)5-Sep-00 3:28
sussRonald L. Russell Jr. (Ron)5-Sep-00 3:28 
GeneralRe: IDE and Windows 2000 Problems Pin
arf5-Sep-00 5:42
arf5-Sep-00 5:42 
General*** Dialog Box of Open & Save ****** Pin
Steve Lai1-Sep-00 5:39
Steve Lai1-Sep-00 5:39 
GeneralRe: *** Dialog Box of Open & Save ****** Pin
Paolo Messina1-Sep-00 10:16
professionalPaolo Messina1-Sep-00 10:16 
GeneralReplacement funtion for GetDIBits()-Please Help Pin
Shiv31-Aug-00 22:42
Shiv31-Aug-00 22:42 
GeneralRe: Replacement funtion for GetDIBits()-Please Help Pin
jschacker1-Sep-00 10:56
jschacker1-Sep-00 10:56 
GeneralMemory leak detection tool Pin
Øyvind Bratland31-Aug-00 22:16
sussØyvind Bratland31-Aug-00 22:16 
GeneralRe: Memory leak detection tool Pin
Alex Gorev1-Sep-00 5:35
Alex Gorev1-Sep-00 5:35 
GeneralRe: Memory leak detection tool Pin
roger C1-Sep-00 10:34
roger C1-Sep-00 10:34 
GeneralRe: Memory leak detection tool Pin
Michael Dunn1-Sep-00 14:16
sitebuilderMichael Dunn1-Sep-00 14:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.