[Project_owners] URL decoding

Eelco van Kuik moz-needlesearch at planet.nl
Mon Feb 9 20:10:42 EST 2004


However...!

If I do the same, but I encode the string with ISO-8859-1(%E1+%DF+%F5)
it gives an error.

And it could be any of the hundreds of types of encoding sequences there
are.

I'm afraid I'm right back where I started.....

Or does anybody here know I might get this to work?

function decode() {
	const c = "@mozilla.org/intl/scriptableunicodeconverter";
	const i = Components.interfaces.nsIScriptableUnicodeConverter;

	var ucConverter = Components.classes[c].getService(i);
	ucConverter.charset="ISO-8859-1";
	
	//var str = '%c3%A1+%C3%9F+%C3%B5'; 	//UTF-8
	var str = '%E1+%DF+%F5';			//ISO-8859-1
	str 	= str.replace(/[+]/g, ' ')
	str 	= str.replace(/%/gi, '\\u00')
	var st	= ucConverter.ConvertFromUnicode(str);
	eval ('alert(\'' + str + '\')')
}


Regards,

Eelco van Kuik


> -----Oorspronkelijk bericht-----
> Van: project_owners-bounces at mozdev.org 
> [mailto:project_owners-bounces at mozdev.org] Namens Erwin Wessels
> Verzonden: maandag 9 februari 2004 17:41
> Aan: Mozdev Project Owners List
> Onderwerp: Re: [Project_owners] URL decoding
> 
> 
> Good. Now to state the extremely obvious: the + is a space character 
> encoding. It should/could be %20, but for historical reasons, etc.etc.
> 
> -E
> 
> Eelco van Kuik wrote:
> 
> >?? This actually works.
> >
> >I see this is new in ECMA scripting.
> >
> >Thanks!
> >
> >Regards,
> >
> >Eelco van Kuik
> >
> >  
> >
> >>-----Oorspronkelijk bericht-----
> >>Van: project_owners-bounces at mozdev.org 
> >>[mailto:project_owners-bounces at mozdev.org] Namens Karsten Düsterloh
> >>Verzonden: maandag 9 februari 2004 17:04
> >>Aan: Mozdev Project Owners List
> >>Onderwerp: Re: [Project_owners] URL decoding
> >>
> >>
> >>Eelco van Kuik aber hob zu reden an und schrieb:
> >>    
> >>
> >>>	// This is á ß õ urlencoded with UTF-8
> >>>      
> >>>
> >>No, it isn't.
> >>
> >>    
> >>
> >>>	var str = '%c3%A1+%C3%9F+%C3%B5';
> >>>      
> >>>
> >>1. This is just a string, so can use decodeURI(str).
> >>2. And that will lead to 'á+ß+õ', because these + signs 
> >>aren't encoded.
> >>
> >>
> >>Karsten
> >>_______________________________________________
> >>Project_owners mailing list
> >>Project_owners at mozdev.org
> >>http://mozdev.org/mailman/listinfo/project_owners
> >>
> >>    
> >>
> >
> >
> >_______________________________________________
> >Project_owners mailing list
> >Project_owners at mozdev.org
> >http://mozdev.org/mailman/listinfo/project_owners
> >  
> >
> 
> -- 
> This is a signature.
> 
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 




More information about the Project_owners mailing list