The anchor of the heading and the link have different encoding:
== A&B&C&D&E == [[#A&B&C&D&E]]
The visualization does not differ: A&B&C&D&E
The link does not match to the anchor of the heading.
- The anchor of the heading is #A.26B.26C.26amp.3BD.26amp.3Bamp.3BE (also in TOC)
- The link points to #A.26B.26C.26D.26amp.3BE
With enabled $wgExperimentalHtmlIds = true:
- The anchor of the heading is #A_B_C_amp;D_amp;amp;E (also in TOC)
- The link points to #A_B_C_D_amp;E
Expected result: The link should match to the anchor of the heading.