Opened 8 years ago

Closed 8 years ago

#13187 closed defect (fixed)

[PATCH] Set encoding of remote control error pages to UTF-8 and HTML-escape the localized messages

Reported by: floscher Owned by: floscher
Priority: normal Milestone: 16.07
Component: Core remotecontrol Version: latest
Keywords: encoding html Cc:


Currently the error pages of the remote control are delivered to the browser without information about the encoding (neither via HTTP-header nor via <meta>-tag in the HTML), while in fact the pages are encoded with UTF-8. So these pages are displayed incorrectly when the user has not set UTF-8 as default encoding in his/her browser and the page contains special characters like Umlauts.

An example is when you set the display language of JOSM to German. Then the page reads Die Minima müssen geringer als die Maxima sein.

This patch both adds the encoding to the HTTP-header and adds <meta charset="utf8"> to the HTML of the error pages. Additionally it also adds HTML-escaping to the localized messages, so they could even contain <, > or & and still be displayed correctly.

The patch has been created against version 10583 and is attached to this ticket, or can be viewed at (Raw patch, Raw diff)

Attachments (2)

776bb6d8b1a0e35492151835f7ac612ede1f8596.patch (6.8 KB ) - added by floscher 8 years ago.
59c2a1c268fc1f309258b75729b5bd450331ec22.patch (7.3 KB ) - added by floscher 8 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by stoecker, 8 years ago

Two points:

  • I'm not sure if omitting head, html and body is really a good idea even if HTML5 allows it. These few characters don't cost much, but it can be expected that not everybody correctly deals with omitting them.
  • The tr() change would be correct like this:
    tr("The following keys are mandatory, but have not been provided: {0}",
    Utils.join(", ", missingKeys)));

comment:2 by Don-vip, 8 years ago

Milestone: 16.07

comment:3 by Don-vip, 8 years ago

Component: CoreCore remotecontrol
Keywords: encoding html added; remotecontrol removed

comment:4 by Don-vip, 8 years ago

Status: newneedinfo

Looks good, thanks for the patch :) Can you please update it by taking into account Dirk's remarks, then I'll commit it?

comment:5 by floscher, 8 years ago

Thank you for the review. I attached the improved patch taking both suggestions into account.

comment:6 by Don-vip, 8 years ago

Resolution: fixed
Status: needinfoclosed

In 10587/josm:

fix #13187 - Set encoding of remote control error pages to UTF-8 and HTML-escape the localized messages (patch by floscher)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain floscher.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.