Modification: Copilot made a good point that USE_ATTRIBUTE_MODE is too generic for the ts.h header. Updating to:
constexpr bool TS_HTML_ESCAPE_USE_ATTRIBUTE_MODE = true; On Mon, Jul 20, 2026 at 11:50 AM Brian Neradt <[email protected]> wrote: > [email protected]: > > Per issue: > https://github.com/apache/trafficserver/issues/13331 > > I'm proposing adding an API to perform HTML escaping: > > constexpr bool USE_ATTRIBUTE_MODE = true; > > TSReturnCode TSStringHtmlEscape(const char * str, int str_len, char * dst, > size_t dst_size, size_t * length, bool use_attribute_mode); > > TSReturnCode TSStringHtmlUnescape(const char * str, int str_len, char * > dst, size_t dst_size, size_t * length); > > This is pretty analogous to our current TSStringPercentEncode/ > TSStringPercentDecode API. See the draft PR implementing this here: > https://github.com/apache/trafficserver/pull/13408 > > Please let me know if you have any thoughts or concerns. > > Thanks, > Brian Neradt > -- > "Come to Me, all who are weary and heavy-laden, and I will > give you rest. Take My yoke upon you and learn from Me, for > I am gentle and humble in heart, and you will find rest for > your souls. For My yoke is easy and My burden is light." > > ~ Matthew 11:28-30 > -- "Come to Me, all who are weary and heavy-laden, and I will give you rest. Take My yoke upon you and learn from Me, for I am gentle and humble in heart, and you will find rest for your souls. For My yoke is easy and My burden is light." ~ Matthew 11:28-30
