Is there a helper function to safely encode a user-provided string so I don't accidentally shoot mys

Is there a helper function to safely encode a user-provided string so I don't accidentally shoot myself in the foot with XSS later down the road?
Was this page helpful?