52cee2eff9e953d4584a415b8a9b84bd2326d3cd
braney
  Tue Aug 18 11:14:37 2026 -0700
hgTables: encode track menu and schema text consistently, refs #38123

diff --git src/hg/hgTables/bigBed.c src/hg/hgTables/bigBed.c
index 3a9ac5e07d4..df23211aa47 100644
--- src/hg/hgTables/bigBed.c
+++ src/hg/hgTables/bigBed.c
@@ -10,30 +10,31 @@
 #include "localmem.h"
 #include "jksql.h"
 #include "cheapcgi.h"
 #include "cart.h"
 #include "web.h"
 #include "bed.h"
 #include "hdb.h"
 #include "trackDb.h"
 #include "obscure.h"
 #include "hmmstats.h"
 #include "correlate.h"
 #include "asParse.h"
 #include "bbiFile.h"
 #include "bigBed.h"
 #include "hubConnect.h"
+#include "htmshell.h"
 #include "asFilter.h"
 #include "hgTables.h"
 #include "trackHub.h"
 #include "chromAlias.h"
 #include "bPlusTree.h"
 #include "errCatch.h"
 
 
 boolean isBigBed(char *database, char *table, struct trackDb *parent,
 	struct customTrack *(*ctLookupName)(char *table))
 /* Local test to see if something is big bed.  Handles hub tracks unlike hIsBigBed. */
 {
 struct trackDb *tdb = hashFindVal(fullTableToTdbHash, table);
 
 // if "table" is explicitly listed, we're going to use that instead of any bigDataUrl
@@ -536,80 +537,81 @@
 hPrintf("<B>Database:</B> %s", trackHubSkipHubName(database));
 hPrintf("&nbsp;&nbsp;&nbsp;&nbsp;<B>Primary Table:</B> %s ", table);
 printf("<B>Data last updated:&nbsp;</B>%s<BR>\n", firstWordInLine(sqlUnixTimeToDate(&timep, FALSE)));
 
 printDownloadLink("Big Bed", tdb, fileName);
 
 if (bbi->version >= 2)
     {
     hPrintf("<BR><B>Item Count:</B> ");
     printLongWithCommas(stdout, bigBedItemCount(bbi));
     }
 printTypeHelpDesc(tdb->type);
 printTableBrowserLink(tdb, table);
 
 hPrintf("<BR>\n");
-hPrintf("<B>Format description:</B> %s<BR>", as->comment);
+// the autoSql comes from the hub's data file when this is a hub track
+hPrintf("<B>Format description:</B> %s<BR>", hubEncode(tdb, as->comment));
 
 /* Put up table that describes fields. */
 hTableStart();
 hPrintf("<TR><TH>field</TH>");
 if (ivList != NULL)
     hPrintf("<TH>example</TH>");
 hPrintf("<TH>description</TH> ");
 puts("</TR>\n");
 struct asColumn *col;
 int colCount = 0;
 char *row[bbi->fieldCount];
 char startBuf[16], endBuf[16];
 if (ivList != NULL)
     {
     char *dupeRest = lmCloneString(lm, ivList->rest);	/* Manage rest-stomping side-effect */
     bigBedIntervalToRow(ivList, chromList->name, startBuf, endBuf, row, bbi->fieldCount);
     ivList->rest = dupeRest;
     }
 for (col = as->columnList; col != NULL; col = col->next)
     {
-    hPrintf("<TR><TD><TT>%s</TT></TD>", col->name);
+    hPrintf("<TR><TD><TT>%s</TT></TD>", hubEncode(tdb, col->name));
     if (ivList != NULL)
-	hPrintf("<TD>%s</TD>", row[colCount]);
-    hPrintf("<TD>%s</TD></TR>", col->comment);
+	hPrintf("<TD>%s</TD>", hubEncode(tdb, row[colCount]));
+    hPrintf("<TD>%s</TD></TR>", hubEncode(tdb, col->comment));
     ++colCount;
     }
 
 /* If more fields than descriptions put up minimally helpful info (at least has example). */
 for ( ; colCount < bbi->fieldCount; ++colCount)
     {
     hPrintf("<TR><TD><TT>column%d</TT></TD>", colCount+1);
     if (ivList != NULL)
-	hPrintf("<TD>%s</TD>", row[colCount]);
+	hPrintf("<TD>%s</TD>", hubEncode(tdb, row[colCount]));
     hPrintf("<TD>n/a</TD></TR>\n");
     }
 hTableEnd();
 
 if (ivList != NULL)
     {
     /* Put up another section with sample rows. */
     webNewSection("Sample Rows");
     hTableStart();
 
     /* Print field names as column headers for example */
     hPrintf("<TR>");
     int colIx = 0;
     for (col = as->columnList; col != NULL; col = col->next)
 	{
-	hPrintf("<TH>%s</TH>", col->name);
+	hPrintf("<TH>%s</TH>", hubEncode(tdb, col->name));
 	++colIx;
 	}
     for (; colIx < colCount; ++colIx)
 	hPrintf("<TH>column%d</TH>", colIx+1);
     hPrintf("</TR>\n");
 
     /* Print sample lines. */
     struct bigBedInterval *iv;
     for (iv=ivList; iv != NULL; iv = iv->next)
 	{
 	bigBedIntervalToRow(iv, chromList->name, startBuf, endBuf, row, bbi->fieldCount);
 	hPrintf("<TR>");
 	for (colIx=0; colIx<colCount; ++colIx)
 	    {
 	    writeHtmlCell(row[colIx]);