Text.FilterUTF16
----------------

Filters text to UTF-16.

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

MBS( "Text.FilterUTF16"; Text { ; Replacement } ) 

**MBS**( **"Text.FilterUTF16";** /\* Filters text to UTF-16. \*/  
**$Text**; /\* The text to process.e.g. "Hello 😀 World" \*/   
**$Replacement**) /\* Optional; Replacement text for invalid characters.  
Default is empty.e.g. "\[emoji\]" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | The text to process. | "Hello 😀 World" |  |
| Replacement | Replacement text for invalid characters.   Default is empty. | "\[emoji\]" | Optional |

### Result

Returns text or error.

### Description

Filters text to UTF-16.  
Removes all UTF-32 characters which can't fit into UTF-16.  
Normally UTF-32 range characters exceeding the UTF-16 range are stored as two characters in UTF-16.  
This function removes those for software, which may not handle them correctly.  
### Examples

Remove emojis:

 MBS ( "Text.FilterUTF16"; "Hello 😀 World"; "\[emoji\]" )  
<small>  
Example result: "Hello \[emoji\] World"</small>Filter emojis:

 MBS ( "Text.FilterUTF16"; "Test 🍎 🍓 🍒"; "?" )  
<small>  
Example result: Test ? ? ?</small>### Release notes

- **Version 9.3**
    - Added [Text.FilterUTF16](http://www.mbsplugins.eu/TextFilterUTF16.shtml) function.

### Blog Entries

- [Save Records as PDF oddities with FileMaker Server on Linux](https://www.mbsplugins.de/archive/2020-11-28/Save_Records_as_PDF_oddities_w/monkeybreadsoftware_blog_filemaker)
- [Neues vom MBS Plugin 9.3](https://www.mbsplugins.de/archive/2019-09-13/Neues_vom_MBS_Plugin_93/monkeybreadsoftware_blog_filemaker)
- [Whats new in MBS FileMaker Plugin version 9.3](https://www.mbsplugins.de/archive/2019-08-17/Whats_new_in_MBS_FileMaker_Plu/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.3pr3](https://www.mbsplugins.de/archive/2019-06-21/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 20th June 2019 , last changed 31st January 2023

  
[Text.FilterSwissQRCode](TextFilterSwissQRCode.md) - [Text.FindBetween](TextFindBetween.md)

[HTML Version](TextFilterUTF16.shtml)