0

I have been stuck for a while with this issue.

When I merge a field and want it sent to uppercase I normaly use [onshow.field;ope=upper] and it works great for almost all fields but we are sometimes using special chars like æ, ø and å and these are not being sent to upper like the rest.

Are there anyone that know what could be wrong?

sshine
  • 15,635
  • 1
  • 41
  • 66
Benjamin Karlog
  • 330
  • 1
  • 6
  • 22
  • 1
    Without knowing OpenTBS in particular, they are probably using a regex (or`strtoupper`) that only catches a-z. A fix could be finding the code that performs the transformation and changing it. A simple change could be adding æ, ø, å to the regex. A better change could be using [`mb_strtoupper`](https://stackoverflow.com/questions/5969803/strtoupper-php-function-for-utf-8-string) so it works for *all* unicode. If you don't figure it out by Monday, I'll return to a computer then and I can give a more specific answer. – sshine Aug 02 '18 at 17:22
  • I have implemented a "hack" were I use strtoupper for all vars, and this solves the immediate problem, but it is not a good way to solve it. I will try to see if I can find the source in the openTBS libary and see what happens. – Benjamin Karlog Aug 02 '18 at 21:09

1 Answers1

1

Going through the source code of OpenTBS and searching for "upper", you get to the cryptic constant "15", which signifies conversion to uppercase. It actually does support Unicode conversion:

($Loc->OpeUtf8) ? mb_convert_case($CurrVal, MB_CASE_UPPER, 'UTF-8') : strtoupper($CurrVal)

And to enable Unicode, it seems that you also need ope=utf8. It seems that you can have multiple filters by separating them with a comma, so in your template, you can write:

[onshow.field;ope=utf8,upper]

Or you could change the source code to always support Unicode by default on line 1293:

$Loc->OpeUtf8 = true;
sshine
  • 15,635
  • 1
  • 41
  • 66