Package org.a2aproject.sdk.util
Class HtmlEscapeUtils
java.lang.Object
org.a2aproject.sdk.util.HtmlEscapeUtils
Utilities for removing HTML escaping applied by Gson's
JsonWriter
when htmlSafe is enabled (the default).-
Method Summary
Modifier and TypeMethodDescriptionstatic StringremoveHtmlEscaping(String json) Removes HTML escaping applied by Gson'sJsonWriterwhenhtmlSafeis enabled (the default).
-
Method Details
-
removeHtmlEscaping
Removes HTML escaping applied by Gson'sJsonWriterwhenhtmlSafeis enabled (the default). Restores literal<,>,&,=, and'.Both lowercase (
<) and uppercase (<) hex digits are handled, as the JSON specification permits either case for unicode escapes.Gson also escapes U+2028 (line separator) and U+2029 (paragraph separator) in HTML-safe mode, but those are left as-is because they are valid JSON encodings that preserve the original characters without data corruption.
- Parameters:
json- the JSON string potentially containing HTML-escaped sequences- Returns:
- the JSON string with literal characters restored
-