Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a javascript function that takes as argument a string that is UrlEncoded.

I'm using tags with href="javascript:..." (I know it's wrong to use this, but it's legacy code that i have to maintain... and changing this to onclick would break our API.)

Chrome and Firefox interpret the '%C3%A9' to 'é' correctly but ie interprets it as 'é'. If it was in onclick, i could explicitely unescape the string, but with the href="javascript.." IE interprets its before i can unescape it correctly.

<a href="javascript: alert('%C3%A9')">href</a>
<a href="#" onclick="alert('%C3%A9')">onclick</a>

See the fiddle : http://jsfiddle.net/nCvsg/2/ (in IE).

Document is set to UTF8. Is there a way to solve this in IE?

share|improve this question
    
This can be more easily tested with location = "javascript: alert('%C3%A9')";. It seems like IE does not support UTF-8 there. –  Fabrício Matté Jul 22 '13 at 20:48
1  
Does it have to be URL-encoded? This seem to work in all browsers: alert('\u00E9'), and even alert('é'). Don't know what your constraints are. –  Natasha Banegas Jul 22 '13 at 22:21
    
Is your document's charset UTF-8? –  EricLaw Jul 22 '13 at 22:49
    
If I don't URL encode it it works yes. But I unfortunately need to keep stuff url encoded for now. Yes my document charset is UTF-8. –  William Fortin Jul 23 '13 at 12:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.