panepeter
panepeter

Reputation: 4242

Using special characters as CASE keys in typoscript

I'm trying to send a mail via the powermail extension to different receivers, depending on the value a user has selected in a form dropdown. This practice of dynamic receivers is described in the powermail documentation. Basically:

receivers1.email = CASE
receivers1.email {

    key.data = GP:tx_powermail_pi1|field|receiver

    1 = TEXT
    1.value = [email protected]

    default = TEXT
    default.value = [email protected]
}

Now I'm facing the following problem: my values for "receiver" are not numeric (as in the example), but text values from a dropdown. Some of them contain spaces, some of them contain umlauts (öäüß). If I try to add …

Not wörking = TEXT
Not wörking.value = [email protected]

Typo3 will complain and not update anything. (Bad property! You must enter a property with characters a-z, A-Z and 0-9, no spaces!Nothing was updated!)

I tried simply 'escaping' the forbidden characters with a backslash, not working. Had an idea of converting the key.data via stdWrap rawUrlEncode, but did not work either. Google came up with this solution, but I don't understand what's going on and could not use it successfully.

How can I get around this? Thanks a lot for any kind of hint!

Upvotes: 1

Views: 628

Answers (1)

Paul Beck
Paul Beck

Reputation: 2683

I pretty like your rawUrlEncode solution. Can you provide us your solution of it here? According to this online converter the result should be something like:

key.data = GP:tx_powermail_pi1|field|receiver
key.stdWrap.rawUrlEncode = 1

Not%20w%C3%B6rking = TEXT
Not%20w%C3%B6rking.value = [email protected]

Maybe for each CASE some signs like "%" are not allowed. In that case you maybe refer to the "replacement" function. https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Functions/Replacement/Index.html#replacement

key.data = GP:tx_powermail_pi1|field|receiver
key.stdWrap.replacement {
  10 {
      search.char = 32
      replace = _
  }
  // Add umlauts and other signs!
}

Not_wörking = TEXT
Not_wörking.value = [email protected]

Upvotes: 1

Related Questions