WebView: fix two issues with encoding

git-svn-id: svn://kolibrios.org@7032 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2017-09-28 18:59:04 +00:00
parent 29387f168a
commit f8fdd821fd
3 changed files with 18 additions and 11 deletions

View File

@ -79,8 +79,7 @@ void TWebBrowser::DrawStyle()
if (!header)
{
ChangeCharset("UTF-8", "CP866", #line);
sprintf(#header, "%s - %s", #line, #version);
strcpy(#header, #line);
line = 0;
return;
}
@ -266,7 +265,6 @@ void TWebBrowser::SetStyle() {
if (istag("form")) if (!opened) ignor_text = false;
if(istag("title")) {
if (opened) header=NULL;
else DrawTitle(#header);
return;
}
if (ignor_text) return;
@ -292,7 +290,15 @@ void TWebBrowser::SetStyle() {
DrawBuf.Fill(bg_color);
}
} while(GetNextParam());
if (opened) && (cur_encoding==CH_NULL) debugln("Document has no information about encoding, UTF will be used");
if (opened) && (cur_encoding==CH_NULL) {
cur_encoding = CH_UTF8;
debugln("Document has no information about encoding, UTF will be used");
}
if (opened) {
ChangeCharset(charsets[cur_encoding], "CP866", #header);
sprintf(#header, "%s - %s", #header, #version);
DrawTitle(#header);
}
return;
}
if (istag("a")) {
@ -423,6 +429,7 @@ void TWebBrowser::SetStyle() {
void TWebBrowser::BufEncode(dword set_new_encoding)
{
if (cur_encoding == set_new_encoding) return;
if (o_bufpointer==0)
{
o_bufpointer = malloc(bufsize);
@ -432,11 +439,10 @@ void TWebBrowser::BufEncode(dword set_new_encoding)
{
strcpy(bufpointer, o_bufpointer);
}
if (cur_encoding!=set_new_encoding) {
cur_encoding = set_new_encoding;
debugln(charsets[cur_encoding]);
bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer);
}
debugval("cur_encoding ", cur_encoding);
debugval("set_new_encoding", set_new_encoding);
cur_encoding = set_new_encoding;
bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer);
}
//============================================================================================
void TWebBrowser::DrawScroller()

View File

@ -29,6 +29,7 @@ char *unicode_tags[]={
"#8211", "-",
"#151", "-",
"#149", "-",
"#9642", "-", //square in the middle of the line
"rsquo", "'",
"#39", "'",

View File

@ -30,7 +30,7 @@
char homepage[] = FROM "html\\homepage.htm""\0";
#ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.7";
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.71";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
@ -43,7 +43,7 @@ char rmb_menu[] =
Žç¨áâ¨âì ªíè ª à⨭®ª
Œ¥­¥¤¦¥à § £à㧮ª";
#else
char version[]="Text-based Browser 1.7";
char version[]="Text-based Browser 1.71";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>";