b6fb3bd6caadca912384f7e294d729d1b78f8c4a
jcasper
  Fri Oct 27 17:23:00 2023 -0700
Printed shortLabels on the hgTracks page should use HTML entities
instead of special characters, refs #32512

diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index b059ba5..ab570e6 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -1,16 +1,16 @@
-/* hgTracks - the /riginal, and still the largest module for the UCSC Human Genome
+/* hgTracks - the original, and still the largest module for the UCSC Human Genome
  * Browser main cgi script.  Currently contains most of the track framework, though
  * there's quite a bit of other framework type code in simpleTracks.c.  The main
  * routine got moved to create a new entry point to the bulk of the code for the
  * hgRenderTracks web service.  See mainMain.c for the main used by the hgTracks CGI. */
 
 /* Copyright (C) 2014 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 #include <pthread.h>
 #include <limits.h>
 #include "common.h"
 #include "hCommon.h"
 #include "linefile.h"
 #include "portable.h"
 #include "memalloc.h"
@@ -8368,31 +8368,33 @@
         dyStringPrintf(dsMouseOver, " - this is a container track with %d subtracks of different types "
                 "(super track)", slCount(tdb->children));
     else if (tdbIsComposite(tdb))
         dyStringPrintf(dsMouseOver, " - this is a container track with %d subtracks of similar types "
                 "(composite track)", slCount(tdb->subtracks));
 
     // Print icons before the title when any are defined
     hPrintIcons(track->tdb);
 
     hPrintf("<A class='trackLink' HREF=\"%s\" data-group='%s' data-track='%s' title=\"%s\">", url, track->groupName, track->track, dyStringCannibalize(&dsMouseOver));
 
     freeMem(url);
     freeMem(longLabel);
     }
 
-hPrintf("%s", track->shortLabel);
+char *encodedShortLabel = htmlEncode(track->shortLabel);
+hPrintf("%s", encodedShortLabel);
+freeMem(encodedShortLabel);
 if (track->hasUi)
     hPrintf("</A>");
 
 hPrintf("<BR>");
 }
 
 static void printSearchHelpLink()
 /* print the little search help link next to the go button */
 {
 char *url = cfgOptionDefault("searchHelpUrl","../goldenPath/help/query.html");
 char *label = cfgOptionDefault("searchHelpLabel", "examples");
 if (!url || isEmpty(url))
     return;
 
 printf("<div id='searchHelp'><a target=_blank title='Documentation on what you can enter into the Genome Browser search box' href='%s'>%s</a></div>", url, label);