Skip to content

Commit

Permalink
Fixing #5696 - Chinese encoding does not decode correctly
Browse files Browse the repository at this point in the history
When inputting Chinese to search for graphics, garbled characters appear.
  • Loading branch information
TheWitness committed Apr 5, 2024
1 parent 20034b4 commit d667f41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Cacti CHANGELOG
-issue#5669: System Utilities show incorrect System Memory if memory is larger than 1k
-issue#5677: Compatibility improvements for Spikekill under PHP 8.x
-issue#5693: Fix Spikekill not following correct time in schedule, Improve PHP 8.3 in spikekill process
-issue#5696: When inputting Chinese to search for graphics, garbled characters appear.
-issue#5701: Bad URL formating in the templates_import.php preview mode
-feature#5692: Add a "device enabled/disabled" indicator next to the graphs

Expand Down
4 changes: 2 additions & 2 deletions lib/html_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ function get_filter_request_var(string $name, int $filter = FILTER_VALIDATE_INT,
$value = '';
} elseif ($filter == FILTER_VALIDATE_IS_REGEX) {
if (is_base64_encoded($_REQUEST[$name])) {
$_REQUEST[$name] = base64_decode($_REQUEST[$name], true);
$_REQUEST[$name] = mb_convert_encoding(base64_decode($_REQUEST[$name]), 'UTF-8');
}

$valid = validate_is_regex($_REQUEST[$name]);
Expand Down Expand Up @@ -726,7 +726,7 @@ function validate_store_request_vars(array $filters, string $sess_prefix = ''):v
$value = '';
} elseif ($options['filter'] == FILTER_VALIDATE_IS_REGEX) {
if (is_base64_encoded($_REQUEST[$variable])) {
$_REQUEST[$variable] = base64_decode($_REQUEST[$variable], true);
$_REQUEST[$variable] = mb_convert_encoding(base64_decode($_REQUEST[$variable]), 'UTF-8');
}

$valid = validate_is_regex($_REQUEST[$variable]);
Expand Down

0 comments on commit d667f41

Please sign in to comment.