Skip to content

Saved config invalid when foreign characters are in returned server names #12

Description

@shrodi

I live in the French province of Québec, Canada, and some of the closest speed test servers have French characters in their name/description, which are somehow converted to HTML entities when saved to pfSense config, which breaks the config XML parsing.

For example, in this output of speedtest -f json --selection-details --accept-license --accept-gdpr, you can see words like "Québec" and "Trois-Rivières".

Then, this bad config.xml was saved (and automatically rejected and replaced by a valid backup by pfSense) in /cf/conf. We can see that the characters 'é' and 'è' have been replaced with the HTML entities 'é' and 'è', which break the config XML parsing:

$ xmllint -noout config.xml.bad
config.xml.bad:817: parser error : Entity 'egrave' not defined
:"Cogeco Connexion Inc.","location":"Trois-Riviè
                                                                               ^
config.xml.bad:817: parser error : Entity 'egrave' not defined
":"Rogers Wireless","location":"Trois-Riviè
                                                                               ^
config.xml.bad:817: parser error : Entity 'eacute' not defined
t;,"port":8080,"name":"Fleettel.ca Leader au Qué

As a very quick and dirty fix for me, I created this patch to the widget that simply replaces the most common French accented characters by non-accented characters from the results (so that 'é' and 'è' become 'e', etc,). It works for me, but it's obviously not a generic nor a good solution. The ideal would be to prevent foreign characters to be converted to HTML entities that are not recognized by the pfSense XML parser, but I haven't dug into it yet.

Edit:

I forgot to mention:

  • speedtest.widget.php version: commit 70e501b from origin/main
  • pfSense version: 2.8.0-RELEASE (amd64) on FreeBSD 15.0-CURRENT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions