Text.IdentifyData
-----------------

Checks file type from the data.

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

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

**MBS**( **"Text.IdentifyData";** /\* Checks file type from the data. \*/  
**$Text**; /\* The text to check. \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is UTF-8 for version.  
  
Can also be "hex" or "base64" to provide data encoded with hex or base64 algorithm.e.g. "Hex" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | The text to check. |  |  |
| Encoding | The text encoding for text parameter.    Default is UTF-8 for version.      Can also be "hex" or "base64" to provide data encoded with hex or base64 algorithm. | "Hex" | Optional |

### Result

Returns text or error.

### Description

Checks file type from the data.  
We read the first bytes of the file and decide which file type is may be.  
  
You may use "Hex" or "base64" as encoding to check type before decoding it.  
  
Supported types:  
  
| PDF | PDF document. |
|---|---|
| JPEG | JPEG image. |
| GIF | GIF image. |
| BMP | Windows BMP image |
| WEBP | WebP image. |
| PNG | PNG image. |
| TIFF | TIFF image. |
| GIF | GIF image. |
| SVG | SVG image. |
| ZIP | ZIP file. |
| HEIF | HEIF image file. |
| FMP | FileMaker database. |
| EXE | Windows executable |
| MachO | macOS executable |
| ELF | Linux executable |

  
Returns empty text in case the format is not identified. We can add more formats as needed.   
Please be aware, that a text file may just have the right bytes to look like another file format!  
### Examples

Check content of some hex data:

 MBS ( "Text.IdentifyData"; "89504E470D0A1A0A000000..."; "Hex" )  
<small>  
Example result: PNG</small>### See also

- [Files.IdentifyData](FilesIdentifyData.md)

### Release notes

- **Version 14.0**
    - Added [Container.IdentifyData](https://www.mbsplugins.eu/ContainerIdentifyData.shtml), [Files.IdentifyData](https://www.mbsplugins.eu/FilesIdentifyData.shtml) and [Text.IdentifyData](https://www.mbsplugins.eu/TextIdentifyData.shtml) functions.

### Blog Entries

- [New in MBS FileMaker Plugin 14.0](https://www.mbsplugins.de/archive/2024-01-23/New_in_MBS_FileMaker_Plugin_14/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 14.0 für Claris FileMaker](https://www.mbsplugins.de/archive/2024-01-16/Neues_MBS_Plugin_140_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 14.0 for Claris FileMaker](https://www.mbsplugins.de/archive/2024-01-16/MBS_FileMaker_Plugin_140_for_C/monkeybreadsoftware_blog_filemaker)
- [Identify data content](https://www.mbsplugins.de/archive/2024-01-15/Identify_data_content/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.6pr5](https://www.mbsplugins.de/archive/2023-12-28/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 23th December 2023 , last changed 8th January 2024

  
[Text.HTMLtoStyledText](TextHTMLtoStyledText.md) - [Text.InvalidCharactersForEncoding](TextInvalidCharactersForEncoding.md)

[HTML Version](TextIdentifyData.shtml)