[INTERFACE]
DIALOG, "Получить код страницы", 279, 102;
STATIC, "Кодировка страницы", 4, 4, 108, 20;
COMBO, "utf-8""windows-1251", 128, 4, 144, 92, int Code;
STATIC, "Переменная для текста", 4, 28, 124, 20;
EDIT, 128, 28, 100, 20, string Pade;
BUTTON_OK, "Принять", 64, 52, 100, 20;
BUTTON_CANCEL, "Закрыть", 172, 52, 100, 20;
[END]

[APPEARANCE]
COLOR = 155, 25, 155;
SIZE_X = 8;
SIZE_Y =2;
[END]

[ASSOC_VAR]
Code=0;
Pade=SPade;
V_Pade=#~Pade~;
[END]

[GLOBAL_VAR]
string ~Pade~;
[END]

[FUNCTION_BODY]
function(string #spade, int code);
{
string t;
  if (code==0)//utf-8
  {
  sendgetpython("main_page = web.page_source.encode(^'utf-8^')");
  spade=sendgetpython("print(main_page)");
  if (regexsearch(1, #t, spade, "\\x", IGNORECASE)) strhextodec(CONVERT_T, spade, "\x", #spade);
  spade=utf8toansi(spade);
  }
  if (code==1)//windows-1251
  {
  sendgetpython("main_page = web.page_source");
  spade=sendgetpython("print(main_page)");
  if (regexsearch(1, #t, spade, "\\x", IGNORECASE)) strhextodec(CONVERT_T, spade, "\x", #spade);
  }
}
[END]

[CALL]
(V_Pade, Code)
[END][CALL]()[END]