diff --git a/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/ISepaMessageCreator.kt b/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/ISepaMessageCreator.kt index 8865a344..808e67f7 100644 --- a/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/ISepaMessageCreator.kt +++ b/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/ISepaMessageCreator.kt @@ -5,8 +5,14 @@ interface ISepaMessageCreator { fun createXmlFile(filename: String, replacementStrings: Map): String + fun convertDiacriticsAndReservedXmlCharactersAndCheckIfContainsOnlyAllowedCharacters(stringToTest: String): Boolean { + val convertedString = convertDiacriticsAndReservedXmlCharacters(stringToTest) + + return containsOnlyAllowedCharacters(convertedString) + } + fun containsOnlyAllowedCharacters(stringToTest: String): Boolean - fun convertToAllowedCharacters(input: String): String + fun convertDiacriticsAndReservedXmlCharacters(input: String): String } \ No newline at end of file diff --git a/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/SepaBankTransferBase.kt b/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/SepaBankTransferBase.kt index 4b4e4acf..5db039f4 100644 --- a/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/SepaBankTransferBase.kt +++ b/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/SepaBankTransferBase.kt @@ -26,14 +26,14 @@ open class SepaBankTransferBase( debitorBic, mapOf( SepaMessageCreator.NumberOfTransactionsKey to "1", // TODO: may someday support more then one transaction per file - "DebitorName" to messageCreator.convertToAllowedCharacters(debitor.name), + "DebitorName" to messageCreator.convertDiacriticsAndReservedXmlCharacters(debitor.name), "DebitorIban" to account.iban!!, "DebitorBic" to debitorBic, - "CreditorName" to messageCreator.convertToAllowedCharacters(data.creditorName), + "CreditorName" to messageCreator.convertDiacriticsAndReservedXmlCharacters(data.creditorName), "CreditorIban" to data.creditorIban.replace(" ", ""), "CreditorBic" to data.creditorBic.replace(" ", ""), "Amount" to data.amount.toString(), // TODO: check if ',' or '.' should be used as decimal separator - "Usage" to if (data.usage.isEmpty()) " " else messageCreator.convertToAllowedCharacters(data.usage), + "Usage" to if (data.usage.isEmpty()) " " else messageCreator.convertDiacriticsAndReservedXmlCharacters(data.usage), "RequestedExecutionDate" to RequestedExecutionDateValueForNotScheduledTransfers ), messageCreator diff --git a/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/SepaMessageCreator.kt b/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/SepaMessageCreator.kt index 0d182fcc..069a6ffa 100644 --- a/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/SepaMessageCreator.kt +++ b/fints4k/src/main/kotlin/net/dankito/fints/messages/segmente/implementierte/sepa/SepaMessageCreator.kt @@ -39,12 +39,10 @@ open class SepaMessageCreator : ISepaMessageCreator { override fun containsOnlyAllowedCharacters(stringToTest: String): Boolean { - val convertedString = convertToAllowedCharacters(stringToTest) - - return AllowedSepaCharactersPattern.matcher(convertedString).matches() + return AllowedSepaCharactersPattern.matcher(stringToTest).matches() } - override fun convertToAllowedCharacters(input: String): String { + override fun convertDiacriticsAndReservedXmlCharacters(input: String): String { // TODO: add other replacement strings return input .replace("\"", """) diff --git a/ui/BankingUiCommon/src/main/java/net/dankito/banking/util/InputValidator.kt b/ui/BankingUiCommon/src/main/java/net/dankito/banking/util/InputValidator.kt index 9027c546..d36c1a5d 100644 --- a/ui/BankingUiCommon/src/main/java/net/dankito/banking/util/InputValidator.kt +++ b/ui/BankingUiCommon/src/main/java/net/dankito/banking/util/InputValidator.kt @@ -82,7 +82,7 @@ open class InputValidator { } open fun convertToAllowedSepaCharacters(string: String): String { - return sepaMessageCreator.convertToAllowedCharacters(string) + return sepaMessageCreator.convertDiacriticsAndReservedXmlCharacters(string) }