Page MenuHomePhabricator

Add encoding HTML header to LilyPond output
Open, NormalPublic


This LilyPond output shows UTF-8 characters incorrectly in Firefox 57.0.4 because there’s no encoding specified in the content-type HTML header (it says just text/plain—LilyPond files have no own MIME type?).

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 14 2018, 12:40 PM
Ebe123 claimed this task.Feb 7 2018, 6:14 AM
Ebe123 moved this task from Backlog to In Progress on the MediaWiki-extensions-Score board.
Ebe123 added a subscriber: Ebe123.

No, LilyPond files don't have an official MIME type. On their discussion forums, text/x-lilypond has been brought up. I'm testing on Vagrant, and now it doesn't work on Chrome! (Safari unaffected). In progress.

Content-Type: text/plain; charset=utf-8 would also be better than now, so that the browser wouldn’t use some one-byte encoding instead of UTF-8. If LilyPond once gets an official MIME type, it can be changed then.

TheDJ added a subscriber: TheDJ.Feb 7 2018, 10:48 AM

I'd just use Content-Type: text/x-lilypond; charset=utf-8. A convention good enough for KDE, seems good enough to follow for us.

TheDJ added a comment.Feb 7 2018, 10:49 AM

While you are at it, you could also use Content-Disposition header to make browser download it, and to name the downloaded file.

Change 434355 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/Score@master] Make LilyPond source automatically download

Would there be a preferable name? There is not necessarily any descriptive naming information in the source or the <score tag. At least with the hash the related files can be easily paired.

I don’t think we can easily find a more descriptive file name than the current one. Maybe a new attribute can be introduced for the <score> tag, but that, of course, won’t be available for the currently existing scores.

Change 434355 merged by jenkins-bot:
[mediawiki/extensions/Score@master] Make LilyPond source automatically download

Ebe123 triaged this task as Normal priority.May 31 2018, 7:16 PM
Ebe123 added a project: I18n.

This is odd; the download attribute does not seem to have an effect (in either Chrome or Safari).

On another note, I do not think it is possible to set the MIME type or any headers through the link.

Ebe123 moved this task from Untriaged to Unicode support on the I18n board.May 31 2018, 7:16 PM
TheDJ added a comment.Jun 1 2018, 4:14 AM

Might be a CORS issue, as its a crossdomain link...

Ebe123 added a comment.Jun 1 2018, 4:17 AM

Explains why it works on Vagrant. Is there a way to test/fix?

Ebe123 added a comment.Jun 1 2018, 4:39 AM

A solution would be to encode all the data in the tag, but that would not be preferable as it would cause huge tags.

TheDJ added a subscriber: brion.Jun 1 2018, 5:53 AM

Fixing cors or just adding the right mime type, probably requires some work with the media-storage ppl / someone with some swift file backend experience.

@brion might you be able to point @Ebe123 in the right direction ?