Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper methods for using URI.js against servers not understanding UTF-8 encoded URIs #10

Merged
merged 1 commit into from
Jan 12, 2012

Conversation

mortenn
Copy link
Contributor

@mortenn mortenn commented Jan 12, 2012

Hello,

This patch adds two new static functions - URI.iso8859 and URI.unicode - that replace the URI.encode and URI.decode refs with the old escape/unescape functions - and restores the default.
I have also modified the en/de-codeQuery methods to reference URI.en/de-code in order for the switching of modes to have the least possible impact (and avoiding redefining the methods).

I have also added the two new static methods to the documentation.

// Cheers, Morten

@rodneyrehm
Copy link
Member

wouldn't it also be nice to be able to URI('/%C3%A6.html').iso8859().toString() === '/%E6.html' and vice versa?

@mortenn
Copy link
Contributor Author

mortenn commented Jan 12, 2012

I suppose so, yes, but this patch was written with the intent of using URI.js to enhance older applications, where everything will be ISO and adding doing .iso8859() to each url on such a system would be counterproductive.

The main concern with enabling URI().iso8859().unicode()... is the age old problem of applying the wrong thing in the wrong order, or to the wrong thing.

I would certainly not mind that syntax, but I do not think I will implement that.

@mortenn
Copy link
Contributor Author

mortenn commented Jan 12, 2012

Another thing; new URI('...%E6...') makes IE8 error because %E6 is not valid unicode - this patch should fix that case as well, provided one has called URI.iso8859().

rodneyrehm added a commit that referenced this pull request Jan 12, 2012
Helper methods for using URI.js against servers not understanding UTF-8 encoded URIs
@rodneyrehm rodneyrehm merged commit cdc5d7f into medialize:gh-pages Jan 12, 2012
rodneyrehm added a commit that referenced this pull request Jan 12, 2012
…10, mortenn)

adding .iso8859() and .unicode() to convert an URI's escape encoding
@rodneyrehm
Copy link
Member

included in URI.js v1.4.0

@mortenn
Copy link
Contributor Author

mortenn commented Jan 13, 2012

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants