Fix encoding of reason phase

Created on 12 March 2024, 9 months ago

Problem/Motivation

I had case, where reason phase was "D�plac� Temporairement". This resulted with SQL error when:

$link->setErrorMessage("D�plac� Temporairement".);
$link->save();

Steps to reproduce

Get response 302 with reason phase having special characters, e.g. �.

Proposed resolution

Try to detect correct encoding and convert string. If encoding can't be detected, at least replace e.g. � with "?" to avoid problems.

I modified LinkCheckerService::statusHandling() by adding:

$error = mb_convert_encoding($error, 'UTF-8', mb_detect_encoding($error, ['ASCII', 'UTF-8', 'ISO-8859-1']));

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇵🇱Poland gugalamaciek

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024