Skip to content

Commit

Permalink
replace non-breaking spaces with regular spaces
Browse files Browse the repository at this point in the history
Must use RegEx so we can replace multiple in the same string

Tested in JS console but not tested in gadget

Fixes wikimedia-gadgets#17
  • Loading branch information
NovemLinguae committed Apr 11, 2024
1 parent 0ce19b0 commit 109b461
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Shortdesc-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,9 @@ window.sdh.main = function () {
// Replace hyphens in dates with en dashes
newDescription = newDescription.replace( DATEPATTERN, DATEREPLACEMENT );

// Replace non-breaking spaces with regular spaces
newDescription = newDescription.replace( /\u00A0/g, ' ' );

// Make edits to Wikidata as appropiate
if (
wgQid &&
Expand Down

0 comments on commit 109b461

Please sign in to comment.