diff -uNrp zabbix-4.0.2.orig/database/mysql/schema.sql zabbix-4.0.2/database/mysql/schema.sql
--- zabbix-4.0.2.orig/database/mysql/schema.sql	2019-01-30 13:41:43.831108638 +0900
+++ zabbix-4.0.2/database/mysql/schema.sql	2019-01-30 13:41:46.923160531 +0900
@@ -262,6 +262,7 @@ CREATE TABLE `httpstep` (
 	`timeout`                varchar(255)    DEFAULT '15s'             NOT NULL,
 	`posts`                  text                                      NOT NULL,
 	`required`               varchar(255)    DEFAULT ''                NOT NULL,
+	`encoding`               varchar(64)     DEFAULT ''                NOT NULL,
 	`status_codes`           varchar(255)    DEFAULT ''                NOT NULL,
 	`follow_redirects`       integer         DEFAULT '1'               NOT NULL,
 	`retrieve_mode`          integer         DEFAULT '0'               NOT NULL,
diff -uNrp zabbix-4.0.2.orig/database/postgresql/schema.sql zabbix-4.0.2/database/postgresql/schema.sql
--- zabbix-4.0.2.orig/database/postgresql/schema.sql	2019-01-30 13:41:43.851108975 +0900
+++ zabbix-4.0.2/database/postgresql/schema.sql	2019-01-30 13:41:46.923160531 +0900
@@ -262,6 +262,7 @@ CREATE TABLE httpstep (
 	timeout                  varchar(255)    DEFAULT '15s'             NOT NULL,
 	posts                    text            DEFAULT ''                NOT NULL,
 	required                 varchar(255)    DEFAULT ''                NOT NULL,
+	encoding                 varchar(64)     DEFAULT ''                NOT NULL,
 	status_codes             varchar(255)    DEFAULT ''                NOT NULL,
 	follow_redirects         integer         DEFAULT '1'               NOT NULL,
 	retrieve_mode            integer         DEFAULT '0'               NOT NULL,
diff -uNrp zabbix-4.0.2.orig/frontends/php/app/controllers/CControllerPopupHttpStep.php zabbix-4.0.2/frontends/php/app/controllers/CControllerPopupHttpStep.php
--- zabbix-4.0.2.orig/frontends/php/app/controllers/CControllerPopupHttpStep.php	2019-01-30 13:41:43.619105067 +0900
+++ zabbix-4.0.2/frontends/php/app/controllers/CControllerPopupHttpStep.php	2019-01-30 13:41:46.923160531 +0900
@@ -39,6 +39,7 @@ class CControllerPopupHttpStep extends C
 			'follow_redirects' =>	'in '.implode(',', [HTTPTEST_STEP_FOLLOW_REDIRECTS_ON, HTTPTEST_STEP_FOLLOW_REDIRECTS_OFF]),
 			'timeout' =>			'string|not_empty',
 			'required' =>			'string',
+			'encoding' =>			'string',
 			'status_codes' =>		'string',
 			'templated' =>			'in 0,1',
 			'old_name' =>			'string',
@@ -77,6 +78,7 @@ class CControllerPopupHttpStep extends C
 			'url' => $this->getInput('url', ''),
 			'timeout' => $this->getInput('timeout', DB::getDefault('httpstep', 'timeout')),
 			'required' => $this->getInput('required', ''),
+			'encoding' => $this->getInput('encoding', ''),
 			'status_codes' => $this->getInput('status_codes', ''),
 			'old_name' => $this->getInput('old_name', ''),
 			'pairs' => $this->getInput('pairs', []),
@@ -135,6 +137,7 @@ class CControllerPopupHttpStep extends C
 					'posts' => $page_options['posts'],
 					'pairs' => $page_options['pairs'],
 					'required' => $page_options['required'],
+					'encoding' => $page_options['encoding'],
 					'status_codes' => $page_options['status_codes'],
 					'follow_redirects' => $page_options['follow_redirects'],
 					'retrieve_mode' => $page_options['retrieve_mode']
diff -uNrp zabbix-4.0.2.orig/frontends/php/app/views/popup.httpstep.php zabbix-4.0.2/frontends/php/app/views/popup.httpstep.php
--- zabbix-4.0.2.orig/frontends/php/app/views/popup.httpstep.php	2019-01-30 13:41:43.615104999 +0900
+++ zabbix-4.0.2/frontends/php/app/views/popup.httpstep.php	2019-01-30 13:41:46.923160531 +0900
@@ -148,6 +148,9 @@ $http_popup_form_list
 	->addRow(_('Required string'),
 		(new CTextBox('required', $options['required']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
 	)
+	->addRow(_('Encoding'),
+		(new CTextBox('encoding', $options['encoding']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
+	)
 	->addRow(_('Required status codes'),
 		(new CTextBox('status_codes', $options['status_codes']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
 	);
diff -uNrp zabbix-4.0.2.orig/frontends/php/httpconf.php zabbix-4.0.2/frontends/php/httpconf.php
--- zabbix-4.0.2.orig/frontends/php/httpconf.php	2019-01-30 13:41:43.695106347 +0900
+++ zabbix-4.0.2/frontends/php/httpconf.php	2019-01-30 13:41:46.923160531 +0900
@@ -547,7 +547,7 @@ if (isset($_REQUEST['form'])) {
 				'http_user', 'http_password', 'http_proxy', 'templateid', 'verify_peer', 'verify_host', 'ssl_cert_file',
 				'ssl_key_file', 'ssl_key_password', 'headers', 'variables'
 			],
-			'selectSteps' => ['httpstepid', 'name', 'no', 'url', 'timeout', 'posts', 'required', 'status_codes',
+			'selectSteps' => ['httpstepid', 'name', 'no', 'url', 'timeout', 'posts', 'required', 'encoding', 'status_codes',
 				'follow_redirects', 'retrieve_mode', 'headers', 'variables', 'query_fields', 'post_type'
 			],
 			'httptestids' => getRequest('httptestid')
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/classes/api/managers/CHttpTestManager.php zabbix-4.0.2/frontends/php/include/classes/api/managers/CHttpTestManager.php
--- zabbix-4.0.2.orig/frontends/php/include/classes/api/managers/CHttpTestManager.php	2019-01-30 13:41:43.703106481 +0900
+++ zabbix-4.0.2/frontends/php/include/classes/api/managers/CHttpTestManager.php	2019-01-30 13:41:46.923160531 +0900
@@ -131,7 +131,7 @@ class CHttpTestManager {
 				'ssl_key_file', 'ssl_key_password', 'verify_peer', 'verify_host'
 			],
 			'httptestids' => $httptestids,
-			'selectSteps' => ['httpstepid', 'name', 'no', 'url', 'timeout', 'posts', 'required', 'status_codes',
+			'selectSteps' => ['httpstepid', 'name', 'no', 'url', 'timeout', 'posts', 'required', 'encoding', 'status_codes',
 				'follow_redirects', 'retrieve_mode'
 			],
 			'editable' => true,
@@ -297,7 +297,7 @@ class CHttpTestManager {
 				'ssl_key_file', 'ssl_key_password', 'verify_peer', 'verify_host', 'variables', 'headers'
 			],
 			'hostids' => $templateId,
-			'selectSteps' => ['httpstepid', 'name', 'no', 'url', 'timeout', 'posts', 'required', 'status_codes',
+			'selectSteps' => ['httpstepid', 'name', 'no', 'url', 'timeout', 'posts', 'required', 'encoding', 'status_codes',
 				'follow_redirects', 'retrieve_mode', 'variables', 'headers', 'query_fields'
 			],
 			'preservekeys' => true
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/classes/api/services/CHttpTest.php zabbix-4.0.2/frontends/php/include/classes/api/services/CHttpTest.php
--- zabbix-4.0.2.orig/frontends/php/include/classes/api/services/CHttpTest.php	2019-01-30 13:41:43.707106549 +0900
+++ zabbix-4.0.2/frontends/php/include/classes/api/services/CHttpTest.php	2019-01-30 13:41:46.923160531 +0900
@@ -324,6 +324,7 @@ class CHttpTest extends CApiService {
 				'retrieve_mode' =>		['type' => API_INT32, 'in' => implode(',', [HTTPTEST_STEP_RETRIEVE_MODE_CONTENT, HTTPTEST_STEP_RETRIEVE_MODE_HEADERS])],
 				'timeout' =>			['type' => API_TIME_UNIT, 'flags' => API_NOT_EMPTY | API_ALLOW_USER_MACRO, 'in' => '0:'.SEC_PER_HOUR],
 				'required' =>			['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httpstep', 'required')],
+				'encoding' =>			['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httpstep', 'encoding')],
 				'status_codes' =>		['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httpstep', 'status_codes')]
 			]]
 		]];
@@ -422,6 +423,7 @@ class CHttpTest extends CApiService {
 				'retrieve_mode' =>		['type' => API_INT32, 'in' => implode(',', [HTTPTEST_STEP_RETRIEVE_MODE_CONTENT, HTTPTEST_STEP_RETRIEVE_MODE_HEADERS])],
 				'timeout' =>			['type' => API_TIME_UNIT, 'flags' => API_NOT_EMPTY | API_ALLOW_USER_MACRO, 'in' => '0:'.SEC_PER_HOUR],
 				'required' =>			['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httpstep', 'required')],
+				'encoding' =>			['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httpstep', 'encoding')],
 				'status_codes' =>		['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httpstep', 'status_codes')]
 			]]
 		]];
@@ -448,7 +450,7 @@ class CHttpTest extends CApiService {
 		unset($db_httptest);
 
 		$db_httpsteps = DB::select('httpstep', [
-			'output' => ['httpstepid', 'httptestid', 'name', 'no', 'url', 'timeout', 'posts', 'required',
+			'output' => ['httpstepid', 'httptestid', 'name', 'no', 'url', 'timeout', 'posts', 'required', 'encoding',
 				'status_codes', 'follow_redirects', 'retrieve_mode'
 			],
 			'filter' => ['httptestid' => array_keys($db_httptests)]
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/classes/export/CConfigurationExport.php zabbix-4.0.2/frontends/php/include/classes/export/CConfigurationExport.php
--- zabbix-4.0.2.orig/frontends/php/include/classes/export/CConfigurationExport.php	2019-01-30 13:41:43.711106616 +0900
+++ zabbix-4.0.2/frontends/php/include/classes/export/CConfigurationExport.php	2019-01-30 13:41:46.923160531 +0900
@@ -742,7 +742,7 @@ class CConfigurationExport {
 				'ssl_cert_file', 'ssl_key_file', 'ssl_key_password'
 			],
 			'selectSteps' => ['no', 'name', 'url', 'query_fields', 'posts', 'variables', 'headers', 'follow_redirects',
-				'retrieve_mode', 'timeout', 'required', 'status_codes'
+				'retrieve_mode', 'timeout', 'required','encoding', 'status_codes'
 			],
 			'hostids' => array_keys($hosts),
 			'inherited' => false,
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/classes/export/CConfigurationExportBuilder.php zabbix-4.0.2/frontends/php/include/classes/export/CConfigurationExportBuilder.php
--- zabbix-4.0.2.orig/frontends/php/include/classes/export/CConfigurationExportBuilder.php	2019-01-30 13:41:43.711106616 +0900
+++ zabbix-4.0.2/frontends/php/include/classes/export/CConfigurationExportBuilder.php	2019-01-30 13:41:46.923160531 +0900
@@ -461,6 +461,7 @@ class CConfigurationExportBuilder {
 				'retrieve_mode' => $httpstep['retrieve_mode'],
 				'timeout' => $httpstep['timeout'],
 				'required' => $httpstep['required'],
+				'encoding' => $httpstep['encoding'],
 				'status_codes' => $httpstep['status_codes']
 			];
 		}
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/classes/import/validators/C32XmlValidator.php zabbix-4.0.2/frontends/php/include/classes/import/validators/C32XmlValidator.php
--- zabbix-4.0.2.orig/frontends/php/include/classes/import/validators/C32XmlValidator.php	2019-01-30 13:41:43.715106684 +0900
+++ zabbix-4.0.2/frontends/php/include/classes/import/validators/C32XmlValidator.php	2019-01-30 13:41:46.923160531 +0900
@@ -365,6 +365,7 @@ class C32XmlValidator {
 									'retrieve_mode' =>			['type' => XML_STRING | XML_REQUIRED],
 									'timeout' =>				['type' => XML_STRING | XML_REQUIRED],
 									'required' =>				['type' => XML_STRING | XML_REQUIRED],
+									'encoding' =>				['type' => XML_STRING | XML_REQUIRED],
 									'status_codes' =>			['type' => XML_STRING | XML_REQUIRED]
 								]]
 							]]
@@ -733,6 +734,7 @@ class C32XmlValidator {
 									'retrieve_mode' =>			['type' => XML_STRING | XML_REQUIRED],
 									'timeout' =>				['type' => XML_STRING | XML_REQUIRED],
 									'required' =>				['type' => XML_STRING | XML_REQUIRED],
+									'encoding' =>				['type' => XML_STRING | XML_REQUIRED],
 									'status_codes' =>			['type' => XML_STRING | XML_REQUIRED]
 								]]
 							]]
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/classes/import/validators/C34XmlValidator.php zabbix-4.0.2/frontends/php/include/classes/import/validators/C34XmlValidator.php
--- zabbix-4.0.2.orig/frontends/php/include/classes/import/validators/C34XmlValidator.php	2019-01-30 13:41:43.715106684 +0900
+++ zabbix-4.0.2/frontends/php/include/classes/import/validators/C34XmlValidator.php	2019-01-30 13:41:46.927160600 +0900
@@ -401,6 +401,7 @@ class C34XmlValidator {
 									'retrieve_mode' =>			['type' => XML_STRING | XML_REQUIRED],
 									'timeout' =>				['type' => XML_STRING | XML_REQUIRED],
 									'required' =>				['type' => XML_STRING | XML_REQUIRED],
+									'encoding' =>				['type' => XML_STRING | XML_REQUIRED],
 									'status_codes' =>			['type' => XML_STRING | XML_REQUIRED]
 								]]
 							]]
@@ -805,6 +806,7 @@ class C34XmlValidator {
 									'retrieve_mode' =>			['type' => XML_STRING | XML_REQUIRED],
 									'timeout' =>				['type' => XML_STRING | XML_REQUIRED],
 									'required' =>				['type' => XML_STRING | XML_REQUIRED],
+									'encoding' =>				['type' => XML_STRING | XML_REQUIRED],
 									'status_codes' =>			['type' => XML_STRING | XML_REQUIRED]
 								]]
 							]]
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/classes/import/validators/C40XmlValidator.php zabbix-4.0.2/frontends/php/include/classes/import/validators/C40XmlValidator.php
--- zabbix-4.0.2.orig/frontends/php/include/classes/import/validators/C40XmlValidator.php	2019-01-30 13:41:43.715106684 +0900
+++ zabbix-4.0.2/frontends/php/include/classes/import/validators/C40XmlValidator.php	2019-01-30 13:41:46.927160600 +0900
@@ -490,6 +490,7 @@ class C40XmlValidator {
 									'retrieve_mode' =>			['type' => XML_STRING | XML_REQUIRED],
 									'timeout' =>				['type' => XML_STRING | XML_REQUIRED],
 									'required' =>				['type' => XML_STRING | XML_REQUIRED],
+									'encoding' =>				['type' => XML_STRING | XML_REQUIRED],
 									'status_codes' =>			['type' => XML_STRING | XML_REQUIRED]
 								]]
 							]]
@@ -983,6 +984,7 @@ class C40XmlValidator {
 									'retrieve_mode' =>			['type' => XML_STRING | XML_REQUIRED],
 									'timeout' =>				['type' => XML_STRING | XML_REQUIRED],
 									'required' =>				['type' => XML_STRING | XML_REQUIRED],
+									'encoding' =>				['type' => XML_STRING | XML_REQUIRED],
 									'status_codes' =>			['type' => XML_STRING | XML_REQUIRED]
 								]]
 							]]
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/httptest.inc.php zabbix-4.0.2/frontends/php/include/httptest.inc.php
--- zabbix-4.0.2.orig/frontends/php/include/httptest.inc.php	2019-01-30 13:41:43.735107021 +0900
+++ zabbix-4.0.2/frontends/php/include/httptest.inc.php	2019-01-30 13:41:46.927160600 +0900
@@ -348,7 +348,7 @@ function copyHttpTests($srcHostId, $dstH
 			'ssl_key_password', 'verify_peer', 'verify_host', 'headers'
 		],
 		'hostids' => $srcHostId,
-		'selectSteps' => ['name', 'no', 'url', 'query_fields', 'timeout', 'posts', 'required', 'status_codes',
+		'selectSteps' => ['name', 'no', 'url', 'query_fields', 'timeout', 'posts', 'required','encoding', 'status_codes',
 			'variables', 'follow_redirects', 'retrieve_mode', 'headers'
 		],
 		'inherited' => false
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/schema.inc.php zabbix-4.0.2/frontends/php/include/schema.inc.php
--- zabbix-4.0.2.orig/frontends/php/include/schema.inc.php	2019-01-30 13:41:43.731106953 +0900
+++ zabbix-4.0.2/frontends/php/include/schema.inc.php	2019-01-30 13:41:46.927160600 +0900
@@ -1190,6 +1190,12 @@ return [
 				'length' => 255,
 				'default' => '',
 			],
+			'encoding' => [
+				'null' => false,
+				'type' => DB::FIELD_TYPE_CHAR,
+				'length' => 64,
+				'default' => 'UTF-8',
+			],
 			'status_codes' => [
 				'null' => false,
 				'type' => DB::FIELD_TYPE_CHAR,
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/views/configuration.httpconf.edit.php zabbix-4.0.2/frontends/php/include/views/configuration.httpconf.edit.php
--- zabbix-4.0.2.orig/frontends/php/include/views/configuration.httpconf.edit.php	2019-01-30 13:41:43.731106953 +0900
+++ zabbix-4.0.2/frontends/php/include/views/configuration.httpconf.edit.php	2019-01-30 13:41:46.927160600 +0900
@@ -208,6 +208,7 @@ $steps_table = (new CTable())
 		(new CColHeader(_('Timeout')))->setWidth('50'),
 		(new CColHeader(_('URL')))->setWidth('200'),
 		(new CColHeader(_('Required')))->setWidth('75'),
+		(new CColHeader(_('Encoding')))->setWidth('75'),
 		(new CColHeader(_('Status codes')))
 			->addClass(ZBX_STYLE_NOWRAP)
 			->setWidth('90'),
@@ -266,6 +267,7 @@ foreach ($this->data['steps'] as $stepid
 			$step['timeout'],
 			$url,
 			htmlspecialchars($step['required']),
+			$step['encoding'],
 			$step['status_codes'],
 			(new CCol($removeButton))->addClass(ZBX_STYLE_NOWRAP)
 		]))
diff -uNrp zabbix-4.0.2.orig/frontends/php/include/views/js/configuration.httpconf.edit.js.php zabbix-4.0.2/frontends/php/include/views/js/configuration.httpconf.edit.js.php
--- zabbix-4.0.2.orig/frontends/php/include/views/js/configuration.httpconf.edit.js.php	2019-01-30 13:41:43.727106886 +0900
+++ zabbix-4.0.2/frontends/php/include/views/js/configuration.httpconf.edit.js.php	2019-01-30 13:41:46.927160600 +0900
@@ -455,6 +455,7 @@
 					'post_type' => $step['post_type'],
 					'timeout' => $step['timeout'],
 					'required' => $step['required'],
+					'encoding' => $step['encoding'],
 					'status_codes' => $step['status_codes'],
 					'old_name' => $step['name'],
 					'retrieve_mode' => $step['retrieve_mode'],
@@ -679,6 +680,7 @@
 		add_var_to_opener_obj(form, 'new_httpstep[posts]', httpstep.posts);
 		add_var_to_opener_obj(form, 'new_httpstep[post_type]', httpstep.post_type);
 		add_var_to_opener_obj(form, 'new_httpstep[required]', httpstep.required);
+		add_var_to_opener_obj(form, 'new_httpstep[encoding]', httpstep.encoding);
 		add_var_to_opener_obj(form, 'new_httpstep[status_codes]', httpstep.status_codes);
 		add_var_to_opener_obj(form, 'new_httpstep[follow_redirects]', httpstep.follow_redirects);
 		add_var_to_opener_obj(form, 'new_httpstep[retrieve_mode]', httpstep.retrieve_mode);
@@ -712,6 +714,7 @@
 		add_var_to_opener_obj(form, prefix + '[posts]', httpstep.posts);
 		add_var_to_opener_obj(form, prefix + '[post_type]', httpstep.post_type);
 		add_var_to_opener_obj(form, prefix + '[required]', httpstep.required);
+		add_var_to_opener_obj(form, prefix + '[encoding]', httpstep.encoding);
 		add_var_to_opener_obj(form, prefix + '[status_codes]', httpstep.status_codes);
 		add_var_to_opener_obj(form, prefix + '[follow_redirects]', httpstep.follow_redirects);
 		add_var_to_opener_obj(form, prefix + '[retrieve_mode]', httpstep.retrieve_mode);
diff -uNrp zabbix-4.0.2.orig/include/db.h zabbix-4.0.2/include/db.h
--- zabbix-4.0.2.orig/include/db.h	2019-01-30 13:41:43.599104730 +0900
+++ zabbix-4.0.2/include/db.h	2019-01-30 13:41:46.927160600 +0900
@@ -406,6 +406,7 @@ typedef struct
 	char		*url;
 	char		*posts;
 	char		*required;
+	char		*encoding;
 	char		*status_codes;
 	int		no;
 	int		timeout;
diff -uNrp zabbix-4.0.2.orig/src/libs/zbxdbhigh/dbschema.c zabbix-4.0.2/src/libs/zbxdbhigh/dbschema.c
--- zabbix-4.0.2.orig/src/libs/zbxdbhigh/dbschema.c	2019-01-30 13:41:43.751107290 +0900
+++ zabbix-4.0.2/src/libs/zbxdbhigh/dbschema.c	2019-01-30 17:04:54.600867235 +0900
@@ -328,6 +328,7 @@ const ZBX_TABLE	tables[] = {
 		{"timeout",	"15s",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
 		{"posts",	"",	NULL,	NULL,	ZBX_TYPE_SHORTTEXT_LEN,	ZBX_TYPE_SHORTTEXT,	ZBX_NOTNULL | ZBX_PROXY,	0},
 		{"required",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
+		{"encoding",	"",	NULL,	NULL,	64,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
 		{"status_codes",	"",	NULL,	NULL,	255,	ZBX_TYPE_CHAR,	ZBX_NOTNULL | ZBX_PROXY,	0},
 		{"follow_redirects",	"1",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
 		{"retrieve_mode",	"0",	NULL,	NULL,	0,	ZBX_TYPE_INT,	ZBX_NOTNULL | ZBX_PROXY,	0},
@@ -2299,6 +2300,7 @@ url varchar(2048) DEFAULT '' NOT NULL,\n
 timeout varchar(255) DEFAULT '15s' NOT NULL,\n\
 posts text DEFAULT '' NOT NULL,\n\
 required varchar(255) DEFAULT '' NOT NULL,\n\
+encoding varchar(64) DEFAULT '' NOT NULL,\n\
 status_codes varchar(255) DEFAULT '' NOT NULL,\n\
 follow_redirects integer DEFAULT '1' NOT NULL,\n\
 retrieve_mode integer DEFAULT '0' NOT NULL,\n\
diff -uNrp zabbix-4.0.2.orig/src/libs/zbxdbhigh/host.c zabbix-4.0.2/src/libs/zbxdbhigh/host.c
--- zabbix-4.0.2.orig/src/libs/zbxdbhigh/host.c	2019-01-30 13:41:43.751107290 +0900
+++ zabbix-4.0.2/src/libs/zbxdbhigh/host.c	2019-01-30 14:57:07.405860724 +0900
@@ -4064,6 +4064,7 @@ typedef struct
 	char			*url;
 	char			*posts;
 	char			*required;
+	char			*encoding;
 	char			*status_codes;
 	zbx_vector_ptr_t	httpstepitems;
 	zbx_vector_ptr_t	fields;
@@ -4239,7 +4240,7 @@ static void	DBget_httptests(zbx_uint64_t
 		sql_offset = 0;
 		zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset,
 				"select httpstepid,httptestid,name,no,url,timeout,posts,required,status_codes,"
-					"follow_redirects,retrieve_mode,post_type"
+					"follow_redirects,retrieve_mode,post_type, encoding"
 				" from httpstep"
 				" where");
 		DBadd_condition_alloc(&sql, &sql_alloc, &sql_offset, "httptestid",
@@ -4277,6 +4278,7 @@ static void	DBget_httptests(zbx_uint64_t
 			httpstep->follow_redirects = atoi(row[9]);
 			httpstep->retrieve_mode = atoi(row[10]);
 			httpstep->post_type = atoi(row[11]);
+			httpstep->encoding = zbx_strdup(NULL, row[12]);
 			zbx_vector_ptr_create(&httpstep->httpstepitems);
 			zbx_vector_ptr_create(&httpstep->fields);
 
@@ -4619,7 +4621,7 @@ static void	DBsave_httptests(zbx_uint64_
 
 		zbx_db_insert_prepare(&db_insert_hstep, "httpstep", "httpstepid", "httptestid", "name", "no", "url",
 				"timeout", "posts", "required", "status_codes", "follow_redirects", "retrieve_mode",
-				"post_type", NULL);
+				"post_type", "encoding", NULL);
 	}
 
 	if (0 != num_httptestitems)
@@ -4680,7 +4682,7 @@ static void	DBsave_httptests(zbx_uint64_
 						httpstep->name, httpstep->no, httpstep->url, httpstep->timeout,
 						httpstep->posts, httpstep->required, httpstep->status_codes,
 						httpstep->follow_redirects, httpstep->retrieve_mode,
-						httpstep->post_type);
+						httpstep->post_type, httpstep->encoding);
 
 				for (k = 0; k < httpstep->fields.values_num; k++)
 				{
@@ -4811,6 +4813,7 @@ static void	clean_httptests(zbx_vector_p
 
 			zbx_free(httpstep->status_codes);
 			zbx_free(httpstep->required);
+			zbx_free(httpstep->encoding);
 			zbx_free(httpstep->posts);
 			zbx_free(httpstep->timeout);
 			zbx_free(httpstep->url);
diff -uNrp zabbix-4.0.2.orig/src/zabbix_server/httppoller/httptest.c zabbix-4.0.2/src/zabbix_server/httppoller/httptest.c
--- zabbix-4.0.2.orig/src/zabbix_server/httppoller/httptest.c	2019-01-30 13:41:43.787107896 +0900
+++ zabbix-4.0.2/src/zabbix_server/httppoller/httptest.c	2019-01-30 13:41:46.927160600 +0900
@@ -634,7 +634,7 @@ static void	process_httptest(DC_HOST *ho
 
 	result = DBselect(
 			"select httpstepid,no,name,url,timeout,posts,required,status_codes,post_type,follow_redirects,"
-				"retrieve_mode"
+				"retrieve_mode, encoding"
 			" from httpstep"
 			" where httptestid=" ZBX_FS_UI64
 			" order by no",
@@ -744,6 +744,7 @@ static void	process_httptest(DC_HOST *ho
 
 		db_httpstep.follow_redirects = atoi(row[9]);
 		db_httpstep.retrieve_mode = atoi(row[10]);
+		db_httpstep.encoding = row[11];
 
 		memset(&stat, 0, sizeof(stat));
 
@@ -867,9 +868,17 @@ static void	process_httptest(DC_HOST *ho
 			{
 				char	*var_err_str = NULL;
 
+				/* check encoding */
+				char	*converted_data;
+
+				if ( '\0' != *db_httpstep.encoding)
+					converted_data = convert_to_utf8(page.data, (size_t)page.allocated, db_httpstep.encoding);
+				else
+					converted_data = page.data;
+
 				/* required pattern */
 				if (NULL == err_str && '\0' != *db_httpstep.required &&
-						NULL == zbx_regexp_match(page.data, db_httpstep.required, NULL))
+						NULL == zbx_regexp_match(converted_data, db_httpstep.required, NULL))
 				{
 					err_str = zbx_dsprintf(err_str, "required pattern \"%s\" was not found on %s",
 							db_httpstep.required, httpstep.url);
@@ -877,7 +886,7 @@ static void	process_httptest(DC_HOST *ho
 
 				/* variables defined in scenario */
 				if (NULL == err_str && FAIL == http_process_variables(httptest,
-						&httptest->variables, page.data, &var_err_str))
+						&httptest->variables, converted_data, &var_err_str))
 				{
 					char	*variables = NULL;
 					size_t	alloc_len = 0, offset;
@@ -893,7 +902,7 @@ static void	process_httptest(DC_HOST *ho
 
 				/* variables defined in a step */
 				if (NULL == err_str && FAIL == http_process_variables(httptest, &httpstep.variables,
-						page.data, &var_err_str))
+						converted_data, &var_err_str))
 				{
 					char	*variables = NULL;
 					size_t	alloc_len = 0, offset;
@@ -908,6 +917,8 @@ static void	process_httptest(DC_HOST *ho
 				}
 
 				zbx_free(var_err_str);
+				if ( page.data != converted_data)
+					zbx_free(converted_data);
 			}
 
 			zbx_timespec(&ts);
