Closed Bug 169425 Opened 22 years ago Closed 8 years ago

href="javascript:foo('ä.htm')" translates incorrectly

Categories

(Core :: Networking, defect)

Other
All
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jurgenvm, Assigned: jst)

References

Details

When hyperlink links towards a javascript function call the windows or OS/2
characters with umlauts do not translate correctly, not even when their html
coded ä ü variants are used.
example:
<a
href="javascript:Foo('/BildArchiv/Produkte/Handmessger&auml;te/index.htm')">Handmessgeräte</a>

The &auml; will be translated into ä characters

This was verified with mozilla 1.1 and 1.2a for win32 as well as with warpzilla
1.1 for OS/2

The link works fine with Netscape 4.x
Reassigning to Networking component, which parses URLS. 

I am not familiar with this type of syntax in URLs;
cc'ing Andreas for advice -

jurgenvm@web.de: could you attach a reduced testcase to 
this bug via the "Create a New Attachment" link above? 

Thanks -
Assignee: rogerl → new-network-bugs
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → Networking
Ever confirmed: true
QA Contact: pschwartau → benc
This is essentially the same as bug 169388. Probably invalid, the reason being
that "ä" is not in ASCII, which is required by URI:s. It must therefore be
encoded using UTF-8 _and_ converted to %HH format to be used in URI:s.

The double byte result you get is actually the UTF-8 representation of "ä". The
URI hex notation for this is %C3%A4. That is, replace "&auml;" with "%C3%A4" and
it will work.

What could be a bug, tho, is that "ä" should be encoded automatically by Mozilla
(as recommended by the HTML spec). It seems that it isn't encoded on local
requests, but it is on requests to external sites. If i try to access
http://blah.dom/mäp.html (through a test link), it will encode correctly. If I
try to access http://localhost/blä.html, it only sends the UTF-8 sequence
unescaped. What gives?
Also compare bug 153325, 
"javascript href broken when a variable is containing escaped umlaut"

These comments come from bug 153325 and bug 144429:

------- Additional Comment_ #4 From Phil Schwartau 2002-07-08 17:19 ------- 

Stefan's testcase shows that certain %XX sequences work, but 
that others don't. That reminds me of bug 144429, 
"URL encoding in window.open regressed, URL parsing problem?"


------- Additional Comment_ #11 From Henrik Rundqvist 2002-05-16 05:11 ------- 
Another interesting thing about all this is why "%7E" (tilda)
slips through but "%E4" (a Swedish character) does not?

Study the attached testcase and you'll see what I mean.
Response if you click on "window.open":

  "The requested URL /~Gle was not found on this server."

Notice that the tilda is there. So only some %XX codes gets affected?


------- Additional Comment_ #12 From Johnny Stenback 2002-05-16 09:18 ------- 
The reason for tilde going through but Scandinavian chanracters not going 
through is that we assume that the string is a UTF8 string once we've
unescaped it. We try to convert the UTF8 string to a unicode string
and that can't be done for non-UTF8 encoded non-ASCII characters such as %E4. 
It's a bug in nsJSProtocolHandler.cpp...
Added bug 169575 for clarification and unification of this and other bugs.
Something is definitely wrong.
-> jst
Assignee: new-network-bugs → jst
This adds another spin to the IRI - URI conversion (RFC 3987). See bug 284474
Blocks: iri
if, in the outer-text of an <a href=javascript ...>outer-text</a> you have Umlaute and CTRL-characters, the CTRL-characters are converted to their equivalent %XX%YY%ZZ ... instead of omitted.

example:

	<a href="javascript:printSpecific(document.auth.task_counter3, 'select_this_task', 'cb.3')">Irène Ansermet Uebersetzungen







</a>

which onmouseover in the status bar is represented and onclick called as:
javascript:suomomail3('i.ansermet@bluewin.ch', '4863', 'Ir%C3%A8ne Ansermet Uebersetzungen%0D%0A%0D%0A%0D%0A%0D%0A')

instead of
javascript:suomomail3('i.ansermet@bluewin.ch', '4863', 'Ir%C3%A8ne Ansermet Uebersetzungen')
what should we do with this bug?
Flags: needinfo?(valentin.gosu)
I tested the use case in comment 0 - it is no longer reproducible.

<a
href="javascript:alert('/BildArchiv/Produkte/Handmessger&auml;te/index.htm')">Handmessgeräte</a>

is correctly translated. Copying the link results in javascript:alert('/BildArchiv/Produkte/Handmessger%C3%A4te/index.htm') and the mouseover and alert message correctly display the ä character.
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(valentin.gosu)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.