ZipFile.WriteText
-----------------

Writes a text into the zip archive.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Compression](component_Compression.md) | [3.4](newinversion34.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "ZipFile.WriteText"; Text { ; Encoding } ) 

**MBS**( **"ZipFile.WriteText";** /\* Writes a text into the zip archive. \*/  
**$Text**; /\* The text to write.e.g. "Hello World" \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is native.e.g. UTF8 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | The text to write. | "Hello World" |  |
| 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). | UTF8 | Optional |

### Result

Returns "OK" on success.

### Description

Writes a text into the zip archive.  
This is a way to easily add a text file to a zip archive.  
Please use [ZipFile.CreateFile](ZipFileCreateFile.md) first to create a new file before writing to it.  
  
In version 5.0 of the plugin, the parameters are changed and we got an extra unused parameter between function name and text. This was corrected in 5.1pr3.  
### Examples

Creates a text file:

 MBS ( "[ZipFile.CreateFile](ZipFileCreateFile.md)"; "test.txt"; $date )  
MBS ( "ZipFile.WriteText"; "Hello World" )  
### See also

- [BinaryFile.WriteText](BinaryFileWriteText.md)
- [ZipFile.CreateFile](ZipFileCreateFile.md)
- [ZipFile.WriteFile](ZipFileWriteFile.md)
- [ZipFile.WriteHex](ZipFileWriteHex.md)

### Example Databases

- [Archives/ZipFile](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Archives/ZipFile.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 5.1pr3](https://www.mbsplugins.de/archive/2015-03-30/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2013, Seite 22](https://filemaker-magazin.de/neuigkeit/3701-Appetithappen-FMM_201305)

This function checks for a license.

Created 18th August 2014 , last changed 30th June 2022

  
[ZipFile.WriteHex](ZipFileWriteHex.md) - [iOSApp.AddSwipeGestureRecognizer](iOSAppAddSwipeGestureRecognizer.md)

[HTML Version](ZipFileWriteText.shtml)