Copied from peurKe 's post
For many situations we need to find a way to prevent the DeepL API from removing control characters such as “\t,” “\r,” and “\n” because even when using the “preserve_formatting” or "split_sentences" parameters, the DeepL API tended to break the formatting of translated texts.
Sometimes you want to use placeholders like [cxx] in your strings as well.
I tested several methods, such as using XML or HTML tags. But the most effective method turned out to be using only random numeric character strings as a glossary.
Example: replace the characters “\t” with "158652" and the characters “\n” with “786520” before translation, keep these random numeric character strings, then replace them with the original value after translation.
I adopted this solution because it can be used with any translation API, since a numeric string never needs to be translated.