Wrong logic in wxHtmlWindow?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Vaulter
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu Jun 30, 2005 7:49 am
Location: Russia
Contact:

Wrong logic in wxHtmlWindow?

Post by Vaulter »

i write this code:

Code: Select all

//assume that's wxFrame child class...
wxHtmlWindow* myhtml = new wxHtmlWindow(this);
myhtml->SetInputEncoding(wxFONTENCODING_CP1251);
myhtml->AppendToPage("<center>!!!some this in cyrilic (
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
The logic is quite correct. You forgot to quote one important ifdef block:

Code: Select all

#if !wxUSE_UNICODE
    SetInputEncoding(wxFONTENCODING_ISO8859_1); // for next call
#endif
So, using the control your way in a unicode build should work correctly. Otherwise it will reset the encoding. Try again with a unicode build.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Vaulter
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu Jun 30, 2005 7:49 am
Location: Russia
Contact:

Post by Vaulter »

now i use this code to pass this problem

Code: Select all

class HtmlChatBox :	public wxHtmlWindow
{
  bool HtmlChatBox::SetPage(wxString& source)
  {	
    m_Parser->SetInputEncoding(wxFONTENCODING_CP1251);
    return wxHtmlWindow::SetPage(source);
  }
}
Last edited by Vaulter on Thu Sep 15, 2005 10:11 am, edited 1 time in total.
Vaulter
Earned a small fee
Earned a small fee
Posts: 19
Joined: Thu Jun 30, 2005 7:49 am
Location: Russia
Contact:

Post by Vaulter »

upCASE wrote:Hi!
The logic is quite correct. You forgot to quote one important ifdef block:

Code: Select all

#if !wxUSE_UNICODE
So, using the control your way in a unicode build should work correctly. Otherwise it will reset the encoding. Try again with a unicode build.
but i am not using Unicode and do not want and do not on the point of using it.
if use UNICODE - problem of encoding dosn't appear at a whole

ps: sorry for poor English :)

wRespect, Vaulter
Post Reply