how to set wide-char html to CHtmlEditCtrl

Posted on 2004-11-11
Medium Priority
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
  • 2
  • 2
LVL 16

Accepted Solution

nonubik earned 1500 total points
ID: 12556423
You need to compile your porject with UNICODE char set.
LVL 16

Expert Comment

ID: 12556465
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.

Author Comment

ID: 12637400
Thanks for your response!!

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

Author Comment

ID: 12642557
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month16 days, 19 hours left to enroll

864 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