Skip to content

Firefly III: a personal finances manager

Fix https://github.com/orgs/firefly-iii/discussions/11509

James Cole8814fb0806de
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 2130af3a7d..cacae7bb3b 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Validation;
+use ErrorException;
use FireflyIII\Support\Facades\Preferences;
use Config;
use FireflyIII\Enums\AccountTypeEnum;
@@ -210,7 +211,12 @@ class FireflyValidator extends Validator
$value = strtoupper($value);
// replace characters outside of ASCI range.
- $value = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value);
+ try {
+ $value = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value);
+ } catch(ErrorException $e) {
+ Log::error(sprintf('Could not convert IBAN "%s" to safe characters. Future steps may fail.', $value));
+ Log::error($e->getMessage());
+ }
$search = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
$replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35'];