CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    Jun 2006
    Posts
    4

    Unicode CString to HTML characters

    I use tree languages in my MFC application. The application compiled as UNICODE. I need generate html with some text from the controls, and I want create regular html file that contain html characters instead UNICODE, for example the russian letter 'A' will be written as =& # 1040 ; (without spaces)
    Something like this (IDC_EDIT_TXT contains Unicode text):
    Code:
    CString str;
    CStdioFile fileU(_T("c:\\temp\\unicode.html"),CFile::modeCreate|CFile::modeWrite);
    GetDlgItemText(IDC_EDIT_TXT,str);
    fileU.WriteString(str);
    I tried convert the string with this function:
    Code:
    char szString [1000];
    int len = WideCharToMultiByte(CP_UTF8,0,str,-1,szString,sizeof(szString),NULL,NULL);
    fileU.Write(szString,len);
    but the result was binary unicode string.
    Do you know how to convert it do html characters?
    Last edited by hershs; June 26th, 2006 at 02:55 AM. Reason: Unicode not seen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured