Title: Message
Please find attached the MFCWebBrowserDemoDlg.cpp that i changed to reproduce the bug.
Line #77 is the line where the charset has been removed and the app works fine with it.
Line #74 should be uncommented and line #77 commented to reproduce the bug.
 
Thanks,
 
Michal.
-----Original Message-----
From: Ehsan Akhgari [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 08, 2003 7:37 PM
To: [EMAIL PROTECTED]
Subject: RE: [MSVC] Problem with HTMLWriter

Michal,
 
iso8859-1 is the "Western/European" charset, and is one of the most common charsets.  I don't understand why your code should fail, and I'm not able to reproduce the problem on my machine.  Can you show us the exact code you use to load the contents?  Also, can you show us exactly where the program crashes?

---------
Ehsan Akhgari

List Owner: [EMAIL PROTECTED]

[Email: [EMAIL PROTECTED]; [EMAIL PROTECTED]]
[WWW: http://www.beginthread.com/Ehsan ]

-----Original Message-----
From: BeginThread.com MSVC List [mailto:[EMAIL PROTECTED] On Behalf Of Michal Zuchman
Sent: Monday, April 07, 2003 7:15 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [MSVC] Problem with HTMLWriter

Ok, i found that if i remove the "charset=ISO8859-1" from the html ... the problem is gone.
 
WHY IS THAT?
 
 
-----Original Message-----
From: Michal Zuchman
Sent: Monday, April 07, 2003 2:12 PM
To: '[EMAIL PROTECTED]'
Subject: [MSVC] Problem with HTMLWriter

I'm trying to use Ehsan's HTMLWriter class.
 
The problem is that sometimes the HTMLWriter displays the raw html code in the browser control.
I managed to reproduce the bug in the mfc sample that Ehsan has created.
 
change the htmlWriter.Write( ...
line in the OnInitDialog to write the source of the html file attached to this e-mail.
 
Please let me know what i'm doing wrong.
 
Also, i'm new to this mailing list, could someone please let me know how i can view the mail list.
 
Thanks,
 
Michal.
// MFCWebBrowserDemoDlg.cpp : implementation file
//

#include "stdafx.h"
#include "MFCWebBrowserDemo.h"
#include "MFCWebBrowserDemoDlg.h"

#include "..\HTMLWriter.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMFCWebBrowserDemoDlg dialog

CMFCWebBrowserDemoDlg::CMFCWebBrowserDemoDlg(CWnd* pParent /*=NULL*/)
        : CDialog(CMFCWebBrowserDemoDlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(CMFCWebBrowserDemoDlg)
        m_sHTML = _T("");
        //}}AFX_DATA_INIT
        // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
        m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CMFCWebBrowserDemoDlg::DoDataExchange(CDataExchange* pDX)
{
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CMFCWebBrowserDemoDlg)
        DDX_Control(pDX, IDC_EXPLORER, m_ctlWebBrowser);
        DDX_Text(pDX, IDC_HTML, m_sHTML);
        //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CMFCWebBrowserDemoDlg, CDialog)
        //{{AFX_MSG_MAP(CMFCWebBrowserDemoDlg)
        ON_WM_PAINT()
        ON_WM_QUERYDRAGICON()
        ON_BN_CLICKED(IDC_ADD, OnAdd)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMFCWebBrowserDemoDlg message handlers

BOOL CMFCWebBrowserDemoDlg::OnInitDialog()
{
        CDialog::OnInitDialog();

        // Set the icon for this dialog.  The framework does this automatically
        //  when the application's main window is not a dialog
        SetIcon(m_hIcon, TRUE);                 // Set big icon
        SetIcon(m_hIcon, FALSE);                // Set small icon
        
        // TODO: Add extra initialization here
        m_ctlWebBrowser.Navigate( _T("about:blank"), NULL, NULL, NULL, NULL );

        CHTMLWriter htmlWriter( m_ctlWebBrowser.GetControlUnknown() );

        /*htmlWriter.Write( _T("<html><head><title>My page</title></head>\n")
                _T("<body><p><font face=verdana size=2>This page is written 
dynamically to the\n")
                _T("WebBrowser control using the CHTMLWriter class.")
                _T("<br><br><a href=\"mailto:[EMAIL PROTECTED]">Email 
me</a></font></p></body></html>") );*/

        

        CString temp2 = "<html>\n";
        temp2 += "<head>\n";

        // This line does not work
        //temp2 += "<meta http-equiv='Content-Type' content='text/html; 
charset=iso8859-1'>\n";

        //This line does work
        temp2 += "<meta http-equiv='Content-Type' content='text/html; charset='>\n";

        temp2 += "<title>Chat Window</title>\n";
        temp2 += "</head>\n";
        temp2 += "<body \n";
        temp2 += "border='0' topmargin='0' bottommargin='0' leftmargin='10' 
rightmargin='10' oncontextmenu='return true' >\n";
        temp2 += "<center>\n";
        temp2 += "<TABLE border='0' cellspacing='0' cellpadding='0' width='100%'>\n";
        temp2 += "<TR><TD DIR='LTR'>\n";
        temp2 += "<FONT FACE='Arial' SIZE='2'>\n";
        temp2 += "<font COLOR='blue'>Lisa: </font>\n";
        temp2 += "<font COLOR='black'>Hello, I'm here to answer your questions about 
LivePerson services.  </font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>hello may  i have some information?</font><br><font COLOR='blue'>Lisa: 
</font><font COLOR='black'>Of course.</font><br><font COLOR='blue'>francesco: 
</font><font COLOR='#8B008B'>\n";
        temp2 += "thank you</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>?</font><br><font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>i 
want to know about the price</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>So that we can serve you better, please select the option below which 
most accurately describes your company's annual revenue; <br> <br>a) Up to $1 million 
annual revenue <br>b) $1 million  - $10 million annual revenue                         
             <br>c) $10 million - $20 million annual revenue <br>d) More than $20 
million annual revenue   </font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>because i want this tool for an import export site</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>no the society of the import 
export will be</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>create today in new york city</font><br><font COLOR='blue'>Lisa: 
</font><font COLOR='black'>LivePerson Pro is now available for US$ 99/month per 
concurrent operator.</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>It 
means that you can accept an unlimited number of customer queries but you can only 
have one operator logged in at any given time, per user license.</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>ok</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>Do you have a timeframe for implementing 
the service?</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>fantatastic</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>:)</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>wait, i'm italian</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>so what is a timeframe</font><br><font COLOR='blue'>Lisa:\n";
        temp2 += "</font><font COLOR='black'>No problem.</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>:)))</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>?</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>When are you launching your 
site?</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>When are you going 
online?</font><br><font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>maybe 
today we'll take the host</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>in the next month, i most finish the website first</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>Understood.</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>Is there anything else I can 
do?</font><br><font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>i'm looking 
for some nice tool</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>Have 
a look:</font><br><font \n";
        temp2 += "COLOR='blue'>francesco: </font>\n";
        temp2 += "<font COLOR='#8B008B'>yes, let me understand what is the timeframe 
:))</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'><a 
HREF='http://www.liveperson.com/sb/flash/demo.asp' 
TARGET='newwindow'>http://www.liveperson.com/sb/flash/demo.asp</a></font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>wow, you can olso send me to 
another page!</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>that's fantastic!</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>Thanks.</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>you send me there without that i click nothing</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>:)</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>Exactly.</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>Our chat system allows you to push pages 
to your visitors so you can help them navigate your site, showing the customer new and 
exciting products.</font><br><font COLOR='blue'>francesco: \n";
        temp2 += "</font><font COLOR='#8B008B'>yes yes, i like this.</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>Would you like me to show you more 
features?</font><br><font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>yes, 
first i see that</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>Ok.</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>olso i can see what they have in the shopping chart</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>that's 
wonderfull!</font><br><font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>other 
features? so i tell to the owner of the society</font><br><font COLOR='blue'>Lisa: 
</font><font COLOR='black'>:-)</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'><font color=\"black\">If you'd like to see a list of features available 
in the LivePerson Pro package <a href=\"http://www.liveperson.com/sb/features.asp\"; 
target=\"_blank\">click here</a>.</font></font><br><font COLOR='blue'>francesco: 
</font><font COLOR='#8B008B'>one of the last question, is the possibility to have a 
lot of precompiled answer?</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>Sure:</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>You 
can pre-program canned responses in order to answer frequently asked questions by 
simply clicking a button.  This feature makes your agents a lot more productive and 
makes chatting with multiple customers a snap!</font><br><font COLOR='blue'>francesco: 
</font><font COLOR='#8B008B'>so we don't have to write everything if we got a lot of 
people in the website</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>Exactly!</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>yeah wonderfull</font><br><font COLOR='blue'>francesco: \n";
        temp2 += "</font><font COLOR='#8B008B'>i'll download a trial</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>can i use the trial with another 
website?</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>When is your 
site going online?</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>and then change it for the one of the import export?</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>i really don't know, i'm still 
finishing it\n";
        temp2 += "</font><br>\n";
        temp2 += "<font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>\n";
        temp2 += "(i must create a database :((((( )</font>\n";

        temp2 += "<font COLOR='#8B008B'>:)</font><br><font COLOR='blue'>Lisa: 
</font><font COLOR='black'>Here is what I can do for you:</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>1) A discount- $199 for the first 3 
months (instead of $99 x 3= $297)</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>2) Our $300 training course (for ADVANCED features) for 
FREE!</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>3) A 15 days FULL 
money back\n";
        temp2 += "guarantee- NO risk, NO obligation.</font><br>\n";
        temp2 += "<font COLOR='blue'>Lisa: </font><font COLOR='black'>What do you 
think?</font><br>\n";
        temp2 += "<font 
COLOR='blue'>franjjjjjjjjjjjjjjjjjjjgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjcesco:
 </font><font COLOR='#8B008B'>i think that's wonderfull</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>really</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>but i'm not the 
owner</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>:(((</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>I 
can help you get started in a matter of minutes.</font><br><font COLOR='blue'>Lisa: 
</font><font COLOR='black'>I see.</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>:-(</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>so i might first ask to them</font><br><font COLOR='blue'>Lisa: 
</font><font COLOR='black'>Would you like me to have a product consultant contact you 
with more info and offers?</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>i'm only the internet marketer / webdesigner / 
factotum</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>yes</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>that's good</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>i want this, and i want the more information for let them know about 
this service</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>May I have 
your email address and phone number?</font><br><font COLOR='blue'>francesco: 
</font><font COLOR='#8B008B'>that's because they pay me in % on the sales ( ;))) 
)</font><br><font \n";
        temp2 += "COLOR='blue'>francescfffo: </font>\n";
        temp2 += "<font COLOR='#8B008B'>ok</font><br><font COLOR='blue'>francesco: 
</font><font COLOR='#8B008B'>[EMAIL PROTECTED]</font><br><font COLOR='blue'>francesco: 
</font><font COLOR='#8B008B'>the phone number is italian</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>What is it?</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>0039 3490589729</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>Thank you sir.</font><br><font 
COLOR='blue'>Lisa: </font><font COLOR='black'>:-)</font><br><font COLOR='blue'>Lisa: 
</font><font COLOR='black'>Is there anything else I can do?</font><br><font 
COLOR='blue'>francesco: </font><font COLOR='#8B008B'>i'm italian :) i tell 
you</font><br><font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>oh, i want to 
thank you</font><br><font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>for 
your time</font><br><font COLOR='blue'>Lisa: </font><font COLOR='black'>You are 
welcome. Please do not hesitate to contact us at anytime. We are here 24 hours a day, 
7 days a week.</font><br><font COLOR='blue'>francesco: </font><font COLOR='#8B008B'>i 
think you have done everything</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>really thank you!</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>Thank you,</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>Bye.</font><br><font COLOR='blue'>Lisa: </font><font 
COLOR='black'>:-)</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>bye</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>thanks again</font><br><font COLOR='blue'>francesco: </font><font 
COLOR='#8B008B'>for download trial page?</font><br></FONT>\n";
        temp2 += "</TD></TR></TABLE></center>\n";
        temp2 += "<script language=\"javascript\">\n";
        temp2 += "function scrollDown()\n";
        temp2 += "{\n";
        temp2 += "window.scroll(0, 50000);\n";
        temp2 += "}\n";
        temp2 += "scrollDown();\n";
        temp2 += "</script>\n";
        temp2 += "</BODY>\n";
        temp2 += "</HTML>\n";

        htmlWriter.Write(temp2);
 
        
        return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CMFCWebBrowserDemoDlg::OnPaint() 
{
        if (IsIconic())
        {
                CPaintDC dc(this); // device context for painting

                SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

                // Center icon in client rectangle
                int cxIcon = GetSystemMetrics(SM_CXICON);
                int cyIcon = GetSystemMetrics(SM_CYICON);
                CRect rect;
                GetClientRect(&rect);
                int x = (rect.Width() - cxIcon + 1) / 2;
                int y = (rect.Height() - cyIcon + 1) / 2;

                // Draw the icon
                dc.DrawIcon(x, y, m_hIcon);
        }
        else
        {
                CDialog::OnPaint();
        }
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CMFCWebBrowserDemoDlg::OnQueryDragIcon()
{
        return (HCURSOR) m_hIcon;
}

void CMFCWebBrowserDemoDlg::OnAdd() 
{
        UpdateData( TRUE );

        CHTMLWriter htmlWriter( m_ctlWebBrowser.GetControlUnknown() );

        htmlWriter.Add( m_sHTML );
}

Reply via email to