Skip to content

Utilities.clsStringUtilities

Utilities.clsStringUtilities is a stateless static service that sanitizes raw text before it reaches e-mail, reports, or mailto: links, protecting downstream consumers from Word-originated special characters, non-printable bytes, and characters that would break a mailto: URL.

Purpose

  • Replace known Word-originated special characters (smart quotes, smart apostrophe, bullets, tab) with plain-text equivalents. (BR-CORE-040)
  • Strip any character outside the printable ASCII range (plus CR/LF) from text destined for e-mail or reports, substituting a space for anything removed. (BR-CORE-041)
  • Escape or remove characters that would break a mailto: URL (quotes, #, ?, &, CRLF, tab) before recipient/subject text is placed in one. (BR-CORE-042)

Context

  • Namespace: SAIF.Presentation.Web.Core.Utilities
  • Assembly/package: SAIF.Presentation.Web.Core.Infragistics111 (merged into SAIF.Presentation.Web.Infragistics111.dll via SAIF.BOF.Presentation.Web.Infragistics111.nuspec)

Public members

Member Signature Purpose
CleanString(text) Public Shared Function CleanString(text As String) As String Replaces Word-originated characters — tab with five spaces, smart apostrophe, smart quotes, round bullet, and square bullet — with plain equivalents, then rebuilds the string keeping only printable ASCII (32–126) plus CR (13) and LF (10), substituting a space for everything else.
CleanForEmail(text) Public Shared Function CleanForEmail(text As String) As String Returns Nothing unchanged; otherwise replaces " with ', removes # and ?, replaces & with and, and URL-encodes CRLF and tab so the result is safe to place inside a mailto: URL.

Behavioral notes

  • CleanString's ASCII-range filter silently discards or replaces any non-ASCII character (e.g. accented letters, non-Latin scripts) with a space, which may alter meaning for internationalized text.*
  • CleanForEmail is applied to recipient and subject text before a mailto: string is assembled in AppViewPageBase, but the corresponding body-sanitization call is commented out in that caller, so body text bypasses this sanitization.*

Constraints and usage notes

  • CleanString is lossy for non-ASCII content; callers handling internationalized user input should be aware that non-ASCII characters become spaces rather than being preserved or transliterated.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Presentation.Web.Core.Infragistics111/clsStringUtilities.vb