StringNormalizer helps in normalizing strings for the use as payload in QR Invoices.

import ch.codeblock.qrinvoice.model.util.StringNormalizer;

// ...
final StringNormalizer stringNormalizer = StringNormalizer.create()
        .enableTrim() // removes whitespaces the same as String#trim() does
        .enableReplaceLineBreaks() // CRLF, CR and LF gets replaced by single whitespace
        .enableReplaceTabs() // TAB gets replaced by single whitespace
        .enableReplaceCharacters(); // some of the not allowed characters gets replaced by allowed one. Mainly useful for unsupported types of quotes. List of replacements is subject to expansion later on.

System.out.println(stringNormalizer.normalize(" Instruction\tde\r\n" +
        "«Château-d'Œx» "));
// prints: Instruction de "Château-d'Oex"