Index: class.tslib_fe.php
===================================================================
--- class.tslib_fe.php	(Revision 4382)
+++ class.tslib_fe.php	(Arbeitskopie)
@@ -4117,8 +4117,7 @@
 	 * @return	void		Works directly on $this->content
 	 */
 	function prefixLocalAnchorsWithScript()	{
-		$scriptPath = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
-		$this->content = preg_replace('/(<(a|area).*?href=")(#[^"]*")/i','${1}' . htmlspecialchars($scriptPath) . '${3}',$this->content);
+		$this->content = preg_replace('/(<(?:a|area)\s[^>]*?\bhref\s*=\s*("|\'))(#[^\2]*\2)/is','${1}' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '${3}',$this->content);
 	}
 
 	/**
