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

Fix browsing for non-ascii entity URI under Safari #78

Merged
merged 1 commit into from Jun 24, 2015
Merged

Fix browsing for non-ascii entity URI under Safari #78

merged 1 commit into from Jun 24, 2015

Commits on Jun 21, 2015

  1. Fix browsing for non-ascii entity URI under Safari

    Previously, browsing entities with non-ascii characters in their URI
    under Safari wouldn't work. Directories would be empty, songs wouldn't
    be added. I haven't tried it, but this behavior seems to be common to
    Webkit-based browsers, so Chrome would be affected too.
    
    This turned out to be because Safari normalizes all unicode strings to
    NFC, breaking the link with MPD-spewed URIs, which are in NFD.
    
    An obvious fix would have been to normalize all URIs to NFD, but
    unfortunately, Safari doesn't have `str.normalize()`. Adding
    normalization capabilities to our JS side would have involved
    introductiing libraries such as `unorm`, which is rather big.
    
    We could have done it on the C side, but it involves introducing `icu`,
    which is far from trivial too.
    
    After much fussing around, I stumbled on a simple solution: URI-encode
    our URI when creating our browser table row. This magically prevents
    Safari from trying to mess with our unicode form before we get the
    chance to send it back to our server.
    Virgil Dupras committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    fe44fca View commit details
    Browse the repository at this point in the history