diff --git a/khtml/ecma/kjs_window.cpp b/khtml/ecma/kjs_window.cpp index bd8322231c9a77475f334f6a19e599553a6e6993..d9b26f71d0c8ce0420760b5892b9d8a0380069f9 100644 --- a/khtml/ecma/kjs_window.cpp +++ b/khtml/ecma/kjs_window.cpp @@ -2947,12 +2947,12 @@ void Location::put(ExecState *exec, const Identifier &p, JSValue *v, int attr) // Note that we want to do gotoAnchor even when the hash is already set, so we // scroll the destination into view. - // Setting this must always provide a ref, even if just ; see + // Setting this must always provide a ref, even if just # see // HTML5 2.6. if (str.isEmpty()) { url.setHTMLRef(""); } else { - url.setRef(str); + url.setHTMLRef(KUrl::fromPercentEncoding(str.toUtf8())); } break; case Host: { diff --git a/khtml/xml/dom_docimpl.cpp b/khtml/xml/dom_docimpl.cpp index b8e591026720b46348498e53f7092440a111422e..0453e1b87f899648cfa97952f3f91d1435f221e0 100644 --- a/khtml/xml/dom_docimpl.cpp +++ b/khtml/xml/dom_docimpl.cpp @@ -1696,6 +1696,18 @@ void DocumentImpl::finishParsing ( ) QString DocumentImpl::completeURL(const QString& url) const { + if (url.startsWith(QLatin1Char('#'))) { + const QString ref = KUrl::fromPercentEncoding(url.mid(1).toUtf8()); + KUrl u = baseURL(); + if (ref.isEmpty()) { + u.setHTMLRef(""); + } + else { + u.setHTMLRef(ref); + } + return u.url(); + } + return KUrl(baseURL(),url /*,m_decoderMibEnum*/).url(); }