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

Projects
None yet
2 participants
@mortenn
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@rodneyrehm

rodneyrehm Jan 12, 2012

Member

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

Member

rodneyrehm commented Jan 12, 2012

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

@mortenn

This comment has been minimized.

Show comment
Hide comment
@mortenn

mortenn Jan 12, 2012

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@mortenn

mortenn Jan 12, 2012

Contributor

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().

Contributor

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

Merge pull request #10 from mortenn/gh-pages
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

adding URI.iso8859() and URI.unicode() to switch base charsets (Issue #…
…10, mortenn)

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

This comment has been minimized.

Show comment
Hide comment
@rodneyrehm

rodneyrehm Jan 12, 2012

Member

included in URI.js v1.4.0

Member

rodneyrehm commented Jan 12, 2012

included in URI.js v1.4.0

@mortenn

This comment has been minimized.

Show comment
Hide comment
@mortenn

mortenn Jan 13, 2012

Contributor

Thanks!

Contributor

mortenn commented Jan 13, 2012

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment