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

Generated font URL uses pipe which is invalid character in path #1163

Open
edhgoose opened this issue Aug 22, 2017 · 3 comments
Open

Generated font URL uses pipe which is invalid character in path #1163

edhgoose opened this issue Aug 22, 2017 · 3 comments
Labels
I API / Website / Platform fonts.google.com related stuff

Comments

@edhgoose
Copy link

When generating a set of fonts on fonts.google.com, a URL is generated like this:

<link href="https://fonts.googleapis.com/css?family=Baloo+Bhaijaan|Slabo+27px" rel="stylesheet">

According to the URL spec (best described by this issue comment I believe: symfony/symfony#23944 (comment)) and answers such as this on StackOverflow, or this bug or this suggest that | is causing the problem.

Changing the URL to use %7C instead of | like this:

<link href="https://fonts.googleapis.com/css?family=Baloo+Bhaijaan%7CSlabo+27px" rel="stylesheet">

seems to be the universal solution, which works in browsers consistently and matches the URL spec.

Would it be possible to do this by default? For context, we have non-technical users who are pasting the Google Font URL into a box which is then validated for being a valid URL, and unfortunately, the validator fails (correctly, as per the issue above) with |.

@curry684
Copy link

curry684 commented Aug 22, 2017

I believe it would be better to silently migrate to an acceptable delimiter. ! or $ would work fine in this case, and allow for full backwards compatibility with existing implementations and URLs. Pre-escaped URLs might get double escaped by some implementations.

@davelab6 davelab6 added this to the Questions about Google Fonts service (API) milestone Oct 5, 2017
@davelab6
Copy link
Member

davelab6 commented Oct 5, 2017

Thanks for the feedback on this; its a known issue with the fonts.google.com directory.

@davelab6 davelab6 modified the milestones: Questions about Google Fonts service (API), Directory (fonts.google.com) Oct 13, 2017
@nickserv
Copy link

Either escaping the | character or using a different one would be great. I had to modify my source to manually escape | because it (correctly) breaks v.Nu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I API / Website / Platform fonts.google.com related stuff
Projects
None yet
Development

No branches or pull requests

6 participants