how to set wide-char html to CHtmlEditCtrl

Posted on 2004-11-11
Last Modified: 2013-11-20

I've got a WCHAR * variable which holds html with non-english characters in it (could be chinease, turkish, japanese, hebrew, whatever)

I need to get that html into my CHtmlEditCtrl 's document.  So i use:

      CString temp(lpWideCharStr);

Problem is, I see that lpWideCharStr holds the correct value, but temp already has an invalid value (q. marks instead of the characters)

How do i create a CString with the correct value?  if this is not the way to do it, then how??

I need it ASAP so I guess 500 points would be appropriate.

Question by:zuckera
    LVL 16

    Accepted Solution

    You need to compile your porject with UNICODE char set.
    LVL 16

    Expert Comment

    CHtmlEditCtrl::SetDocumentHTML requires a LPCTSTR parameter.

     If UNICODE  char set is used, it will be a const wchar_t, if not, will be a const char *.
    If you're not using VC++.NET, but VC++6.0, define UNICODE and _UNICODE in your project settings, preprocessor definitions.
    LVL 1

    Author Comment

    Thanks for your response!!

    Is there a way to do it locally to the function and not affect the whole project?
    LVL 1

    Author Comment

    ok, your suggestion worked, i didn't use it since it's not an option (the project is too big to change to unicode w/o investing a lot of time in the conversion.)

    BUT, I suppose you deserve the points :)

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    unable to delete all specified values regedit 38 100
    zeroMAx challenge 20 66
    Annoying "thing" blocks my view 4 30
    wordcount challenge 11 48
    Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
    Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now