Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Encodes an URL component.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Text | 3.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
(old name: String.EncodeURLComponent)
Parameter | Description | Example | Flags |
---|---|---|---|
text | The text to encode. | $URL | |
encoding | The text encoding for text parameter. Default is native. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF-8" | Optional |
Returns encoded string.
Encode blog URL:
MBS("Text.EncodeURLComponent"; "http://www.mbsplugins.de")
Example result: "http%3A%2F%2Fwww%2Embsplugins%2Ede"
Encode file name for FTP URL:
"ftp://monkeybreadsoftware.com/path/" & MBS("Text.EncodeURLComponent"; $filename; "UTF-8")
Encode é in various encodings as URL:
MBS( "Text.EncodeURLComponent"; MBS( "Text.ConvertUnicodeToCharacterDecomposition"; "é" ); "UTF-8" ) & ¶ &
MBS( "Text.EncodeURLComponent"; MBS( "Text.ConvertUnicodeToCharacterComposition"; "é" ); "UTF-8" ) & ¶ &
MBS( "Text.EncodeURLComponent"; "é"; "Windows" ) & ¶ &
MBS( "Text.EncodeURLComponent"; "é"; "Mac" )
Example result:
e%CC%81
%C3%A9
%E9
%8E
Mount with properly encoding french accent:
Set Variable [ $path; Value: MBS( "Files.Mount"; "afp://stockage.madabout.lu/" & MBS( "Text.EncodeURLComponent"; MBS( "Text.ConvertUnicodeToCharacterDecomposition"; "Travail archivé" )); "UTF-8" )) ]
# URL is "afp://test.myserver.local/Travail%20archiv%8E"
Encode emoji:
MBS( "Text.EncodeURLComponent"; "🍎 🍓 🍒"; "UTF-8" )
Example result: %F0%9F%8D%8E%20%F0%9F%8D%93%20%F0%9F%8D%92
This function is free to use.
Created 18th August 2014, last changed 4th March 2023