Fails to fetch emails when subject contains non latin UTF-8 characters.

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
mrz123
Posts: 2
Joined: Wed Feb 07, 2018 10:12 am

Fails to fetch emails when subject contains non latin UTF-8 characters.

Post by mrz123 »

Script URL: /usr/bin/php /var/www/hesk/inc/mail/hesk_pop3.php
Version of script: 2.7.5
Hosting company: Self hosted VPS

Write your message below:

HESK fails to fetch emails when SUBJECT includes non-latin UTF-8 characters

PHP substr cuts UTF-8 encoded strings incorrectly which leads to issues with saving strings to database.

Code: Select all

sudo -u www-data /usr/bin/php /var/www/hesk/inc/mail/hesk_pop3.php
Here is an error message:

Code: Select all

<b>Error:</b><br/><br/>
Can't execute SQL: 
	INSERT INTO `sm_tickets`
	(
		`trackid`,
		`name`,
		`email`,
		`category`,
		`priority`,
		`subject`,
		`message`,
		`dt`,
		`lastchange`,
		`articles`,
		`ip`,
		`language`,
		`openedby`,
		`owner`,
		`attachments`,
		`merged`,
		`status`,
		`latitude`,
		`longitude`,
		`html`,
		`user_agent`,
		`screen_resolution_height`,
		`screen_resolution_width`,
		`due_date`,
		`history`
		, `custom1`, `custom2`, `custom3`, `custom4`, `custom5`, `custom6`, `custom7`, `custom8`, `custom9`, `custom10`, `custom11`, `custom12`, `custom13`, `custom14`, `custom15`, `custom16`, `custom17`, `custom18`, `custom19`, `custom20`, `custom21`, `custom22`, `custom23`, `custom24`, `custom25`, `custom26`, `custom27`, `custom28`, `custom29`, `custom30`, `custom31`, `custom32`, `custom33`, `custom34`, `custom35`, `custom36`, `custom37`, `custom38`, `custom39`, `custom40`, `custom41`, `custom42`, `custom43`, `custom44`, `custom45`, `custom46`, `custom47`, `custom48`, `custom49`, `custom50`
	)
	VALUES
	(
		'62W-D62-P75E',
		'Evgesha Bandenko',
		'xxxx@xxxx.com',
		'1',
		'2',
		'Я очень вас благодарю... За вашу чуткос�',
		'Здравствуйте, Техническая поддержка, <br />\n<br />\nДиагностическая информация(НЕ<br />\nУДАЛЯТЬ!):<br />\nAccount: mailto:xxxx@xxxx.com <br />\nDevice: 9A8C6C32-4F2A-412F-9A30-A1C79700C6E8 <br />\nМодель устройства: iPhone<br />\n Операционная система: iPhone OS 7.1.2<br />\n Версия приложения: 1.2.14 <br />\n<br />\nПожалуйста, опишите проблему здесь: <br />\n<br />\nОтправлено с iPhone',
		NOW(),
		NOW(),
		NULL,
		'',
		'English',
		'-2',
		'7',
		'',
		'',
		'0',
		'',
		'',
		'0',
		'',
		NULL,
		NULL,
		NULL,
		''
		, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''
	)
	</p><p>MySQL said:<br />Incorrect string value: '\xD1' for column 'subject' at row 1</p>
Here is a pull request for fix the issue:

https://github.com/mike-koch/Mods-for-HESK/pull/482

Please include to the next HESK build.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Fails to fetch emails when subject contains non latin UTF-8 characters.

Post by Klemen »

Thanks for the heads up, will be included in the next release using a wrap-around function to avoid errors if multibyte functions are not installed.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
mrz123
Posts: 2
Joined: Wed Feb 07, 2018 10:12 am

Re: Fails to fetch emails when subject contains non latin UTF-8 characters.

Post by mrz123 »

Thanks, looking forward to install new HESK version :)
Post Reply