Using a Javascript on .lasso page

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Replace non-standard characters?

Johan Solve
2018-08-11 14:09 GMT+02:00 Jussi Hirvi <[hidden email]>:

> On 9.8.2018 17.34, Brett Harvey wrote:
>>
>> What’s the best way to replace non-standard characters in a file name?
>> Characters like ä, ü, é, ç, ô  ?
>>
>> #string->(replace('ä','a'));  Doesn’t seem to work…
>
>
> It works in Lasso 8.6, I just tested. I have been using that exact
> replacement before, too.
>
> var('a') = 'Näin tää menee.';
> $a -> replace('ä','a');
> $a;
> => Nain taa menee.
>
> If it does not work, there could be incongruity between the encoding of your
> input and that of your code.

Also make sure that the Lasso source file is saved as UTF8 with BOM.

--
Mvh
Johan Sölve
____________________________________
Montania System AB
Halmstad   Stockholm
http://www.montania.se

Johan Sölve
Mobil +46 709-51 55 70
[hidden email]

Kristinebergsvägen 17, S-302 41 Halmstad, Sweden
Telefon +46 35-136800 |  Fax +46 35-136801

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Replace non-standard characters?

Brett Harvey
In reply to this post by Jolle Carlestam-2
This worked for my needs - thanks!

> On Aug 09, 2018, at 10:13 AM, Jolle Carlestam <[hidden email]> wrote:
>
>
>> 9 aug. 2018 kl. 16:34 skrev Brett Harvey <[hidden email]>:
>>
>> What’s the best way to replace non-standard characters in a file name?
>> Characters like ä, ü, é, ç, ô  ?
>>
>>
>> #string->(replace('ä','a'));  Doesn’t seem to work…
>>
>> Having a foggy brain day - seems like it should be simple.
>
> I would use regex for this. Here’s an example for filenames.
>
> #string->replace(regexp(`([^0-9a-zA-Z-.,_])`), '_’)
>
> The above will replace any char not in the approved range with underscore. it’s better than nto look for specific chars, since that path is an endless mess of fighting creative users.
>
> NB, this is for Lasso 9.
>
> HDB
> Jolle
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
12