Richard-
Does your current code ensure that anchor names only start with a letter a- z? names starting with a number are illegal, and hyphen and underscore are the only permissible punctuation.
I've tested with Mozilla, Opera, IE, lynx, links, w3m and noticed no problems with anchors containing other punctuation or starting with numbers. Keep in mind that these anchors are also used to link to individual sections from elsewhere:
[[Popular songs#99 bottles of beer]]
This will no longer work as expected if we escape the anchor names to satisfy a restriction that no browser seems to implement anyway. My features don't depend on the anchor names, but the anchor linking feature does, and so far I've seen no good alternatives to using the section title as is to make this easy.
Regards,
Erik