Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.1   12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4    Statistic    FMM    Blog  

Text.FilterASCII

Filters text to ASCII.

Component Version macOS Windows Linux Server iOS SDK
Text 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.FilterASCII"; Text { ; Replacement } )   More

Parameters

Parameter Description Example Flags
Text The text to process. "Hello 😀 Wörld"
Replacement Replacement text for invalid characters.
Default is empty.
"?" Optional

Result

Returns text or error.

Description

Filters text to ASCII.
Removes all non ASCII characters which can't fit into 7bit.
This function removes those for software, which may not handle them correctly.
We convert 23 variants of curly quotes into ASCII quotes.

See also Text.RemoveControlCharacters and Text.RemoveAccents functions.

Examples

Test with a lot of special characters:

MBS( "Text.FilterASCII"; "` ‘ ’ • \¶ ¨ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ ¼ ½ ¾ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅐ ⅛ ⅜ ⅝ ⅞ ⅑ ⅒ ↉"; "?")

Example result: "` ' ' * ? ? A A A A A A AE C E E E E I I I I D N O O O O O O U U U U Y P s a a a a a a ae c e e e e i i i i d n o o o o o o u u u u y p y 1/4 1/2 3/4 1/3 2/3 1/5 2/5 3/5 4/5 1/6 5/6 1/7 1/8 3/8 5/8 7/8 1/9 1/10 0/3"

Remove emoji:

MBS( "Text.FilterASCII"; "Test 🍎 🍓 🍒"; "?" )
// shows double ? due to emojis being two characters each

Example result: Test ?? ?? ??

See also

Release notes

Blog Entries

This function is free to use.

Created 8th September 2020, last changed 31st January 2023


Text.FileExtensionToMimeType - Text.FilterUTF16

💬 Ask a question or report a problem