Facility Control

 View Only
  • 1.  File picker - special characters

    Posted 07-07-2019 18:50

    So, if I use the file picker to choose a logo for a team with one of the special characters here in Norway.
    ÆØÅ for example, or just a whitespace. It's referred as %20% (or other codes for special characters).

    Is there a way to set the Dashboard to accept UTF8 characters in parameters like this?

    So far I've solve it with the following:

    var logo = params.getValue('teamInfo_editLogo', 0);

    if (
    logo.indexOf('\%C3\%A6') > -1 ||
    logo.indexOf('\%C3\%86') > -1 ||
    logo.indexOf('\%C3\%B8') > -1 ||
    logo.indexOf('\%C3\%98') > -1 ||
    logo.indexOf('\%C3\%A5') > -1 ||
    logo.indexOf('\%C3\%85') > -1 ||
    logo.indexOf('\%20') > -1
    )
    {
    logo = logo.replace('\%C3\%A6','æ');
    logo = logo.replace('\%C3\%86','Æ');
    logo = logo.replace('\%C3\%B8','ø');
    logo = logo.replace('\%C3\%98','Ø');
    logo = logo.replace('\%C3\%A5','å');
    logo = logo.replace('\%C3\%85','Å');
    logo = logo.replace('\%20',' ');

    params.setValue('teamInfo_editLogo', 0, logo);
    }

    I just kinda hope there's a more elegant sollution out there.


  • 2.  RE: File picker - special characters

    Posted 07-08-2019 14:43

    For display purposes, you can use the built-in JavaScript functions encodeURI and decodeURI:

    var encoded = encodeURI('ÆØÅ');
    ogscript.debug('got encoded text: ' + encoded);

    var decoded = decodeURI(encoded);
    ogscript.debug('got decoded text: ' + decoded);

    With this, I get:


    #DashBoard


  • 3.  RE: File picker - special characters

    Posted 07-08-2019 16:27

    See! I knew there would be a more elegant sollution out there!
    Just didnt think of it myself!

    Thanks James!


    #DashBoard