Clean text for output¶
This operation sanitizes raw text before it is sent to e-mail, reports, or mailto: links, replacing Word-originated special characters, stripping non-printable bytes, and (for e-mail-specific use) removing characters that would break a mailto: URL.
| Field | Value |
|---|---|
| Operation ID | OP-CORE-016 |
| Trigger | Called before sending text to e-mail, reports, or mailto: links |
| Inputs | Raw text |
| Outputs | Sanitized text |
| Primary components | Utilities.clsStringUtilities.CleanString, Utilities.clsStringUtilities.CleanForEmail |
| Entry point | SAIF.Presentation.Web.Core.Infragistics111/clsStringUtilities.vb |
Steps¶
CleanStringreplaces the known Word-originated characters — tab (Chr(9)) with five spaces, smart apostrophe (Chr(146)), smart quotes (Chr(147)/Chr(148)), round bullet (Chr(149)) and square bullet (ChrW(61607)) — with plain equivalents. (BR-CORE-040)- It then rebuilds the string, keeping only characters in the printable ASCII range 32–126 plus CR (13) and LF (10), and substituting a space for everything else. (BR-CORE-041)
CleanForEmailreturnsNothingunchanged; otherwise it replaces"with', removes#and?, replaces&withand, and URL-encodes CRLF and tab. (BR-CORE-042)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([CleanString / CleanForEmail called]) --> D1{CleanString: Word-originated characters present?}
D1 -->|Yes| S1[Replace tab/smart-quotes/bullets with plain equivalents]
D1 -->|No| S2[No replacement needed]
S1 --> S3[Rebuild string: keep only ASCII 32-126 + CR/LF, else space]
S2 --> S3
Start2([CleanForEmail called]) --> D2{Input is Nothing?}
D2 -->|Yes| R1([Return Nothing unchanged])
D2 -->|No| S4["Replace with ', remove # and ?, replace & with and"]
S4 --> S5[URL-encode CRLF and tab]
Failure and edge-case behavior¶
CleanString's ASCII-range filter silently discards or replaces any non-ASCII characters (e.g. accented letters, non-Latin scripts) with a space, which may alter meaning for internationalized text.*
Related documentation¶
Sources¶
SAIF.Presentation.Web.Core.Infragistics111/clsStringUtilities.vb