Text.EncodeURLComponent
-----------------------

Encodes an URL component.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Text](component_Text.md) | [3.1](newinversion31.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Text.EncodeURLComponent"; Text { ; Encoding } ) 

**MBS**( **"Text.EncodeURLComponent";** /\* Encodes an URL component. \*/  
**$Text**; /\* The text to encode.e.g. $URL \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is native.e.g. "UTF-8" \*/ 

(old name: String.EncodeURLComponent)

### Parameters

| 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](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | "UTF-8" | Optional |

### Result

Returns encoded string.

### Description

Encodes an URL component.  
Please check what text encoding you want to use. Especially what the software processing the hex string expects.  
### Examples

Encode blog URL:

 MBS ("Text.EncodeURLComponent"; "http://www.mbsplugins.de")  
<small>  
Example result: "http%3A%2F%2Fwww%2Embsplugins%2Ede"</small>Encode file name for FTP URL:

 "ftp://monkeybreadsoftware.com/path/" &amp; MBS ("Text.EncodeURLComponent"; $filename ; "UTF-8")  
Encode é in various encodings as URL:

 MBS ( "Text.EncodeURLComponent"; MBS ( "[Text.ConvertUnicodeToCharacterDecomposition](TextConvertUnicodeToCharacterDecomposition.md)"; "é" ); "UTF-8" ) &amp; ¶ &amp;  
MBS ( "Text.EncodeURLComponent"; MBS ( "[Text.ConvertUnicodeToCharacterComposition](TextConvertUnicodeToCharacterComposition.md)"; "é" ); "UTF-8" ) &amp; ¶ &amp;  
MBS ( "Text.EncodeURLComponent"; "é"; "Windows" ) &amp; ¶ &amp;  
MBS ( "Text.EncodeURLComponent"; "é"; "Mac" )  
<small>  
Example result:   
e%CC%81  
%C3%A9  
%E9  
%8E</small>Mount with properly encoding french accent:

 Set Variable \[ $path ; Value: MBS ( "[Files.Mount](FilesMount.md)"; "afp://stockage.madabout.lu/" &amp; MBS ( "Text.EncodeURLComponent"; MBS ( "[Text.ConvertUnicodeToCharacterDecomposition](TextConvertUnicodeToCharacterDecomposition.md)"; "Travail archivé" )); "UTF-8" )) \]  
  
\# URL is "afp://test.myserver.local/Travail%20archiv%8E"   
Encode emoji:

 MBS ( "Text.EncodeURLComponent"; "🍎 🍓 🍒"; "UTF-8" )  
<small>  
Example result: %F0%9F%8D%8E%20%F0%9F%8D%93%20%F0%9F%8D%92</small>Enocode file name for SFTP upload:

 Set Variable \[$EncodedFileName ; Value: MBS ( "Text.EncodeURLComponent"; $FileName ; "utf-8" ) \]  
Set Variable \[$result ; Value: MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; "ftps://test.com/test/" &amp; $EncodedFileName )\]  
### See also

- [CURL.SetOptionURL](CURLSetOptionURL.md)
- [CURL.SetupAWS](CURLSetupAWS.md)
- [Files.Mount](FilesMount.md)
- [Shell.AddArgument](ShellAddArgument.md)
- [Text.ConvertUnicodeToCharacterComposition](TextConvertUnicodeToCharacterComposition.md)
- [Text.ConvertUnicodeToCharacterDecomposition](TextConvertUnicodeToCharacterDecomposition.md)
- [Text.DecodeURLComponent](TextDecodeURLComponent.md)
- [WebView.LoadURL](WebViewLoadURL.md)

### Example Databases

- [CURL/Amazon S3/Amazon S3 Download Picture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Download%20Picture.shtml#1ScriptAnchor_)
- [CURL/Amazon S3/Amazon S3 Upload File](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Upload%20File.shtml#3ScriptAnchor_)
- [CURL/Amazon S3/Amazon S3 Upload Picture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Upload%20Picture.shtml#3ScriptAnchor_)
- [CURL/Email/GMail oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/GMail%20oAuth%20SMTP.shtml#1ScriptAnchor_)
- [CURL/Email/Office 365 oAuth SMTP](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Office%20365%20oAuth%20SMTP.shtml#1ScriptAnchor_)
- [CURL/WebServices/CURL FMS Admin API v18](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/CURL%20FMS%20Admin%20API%20v18.shtml#28ScriptAnchor_)
- [CURL/WebServices/Twilio API Send SMS Json](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/Twilio%20API%20Send%20SMS%20Json.shtml#1ScriptAnchor_)
- [CURL/WebServices/Twitter oAuth](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/Twitter%20oAuth.shtml#4ScriptAnchor_)
- [CURL/WebServices/WeatherBit.io test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/WeatherBit.io%20test.shtml#1ScriptAnchor_)

### Blog Entries

- [Using Gmail with oAuth2 for SMTP with MBS Plugin](https://www.mbsplugins.de/archive/2025-05-08/Using_Gmail_with_oAuth2_for_SM/monkeybreadsoftware_blog_filemaker)
- [SMTP with OAuth for Office 365 in FileMaker](https://www.mbsplugins.de/archive/2022-11-22/SMTP_with_OAuth_for_Office_365/monkeybreadsoftware_blog_filemaker)
- [Storing files for download on FileMaker Server with download URLs](https://www.mbsplugins.de/archive/2018-09-20/Storing_files_for_download_on_/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.3pr4](https://www.mbsplugins.de/archive/2013-06-12/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.2pr7](https://www.mbsplugins.de/archive/2013-04-16/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2021, Seite 23](https://filemaker-magazin.de/neuigkeit/4165-Appetithappen-FMM_202106)
- [Ausgabe 6/2018, Seite 30 bis 31](https://filemaker-magazin.de/neuigkeit/4025-Appetithappen-FMM_201806)

This function is free to use.

Created 18th August 2014 , last changed 30th April 2024

  
[Text.EncodeToXML](TextEncodeToXML.md) - [Text.FileExtensionToMimeType](TextFileExtensionToMimeType.md)

[HTML Version](TextEncodeURLComponent.shtml)