Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Display special characters when they are part of a city name #8533

Closed
nielslange opened this issue Feb 24, 2023 · 9 comments · Fixed by #9117
Closed

Display special characters when they are part of a city name #8533

nielslange opened this issue Feb 24, 2023 · 9 comments · Fixed by #9117
Assignees
Labels
block: checkout Issues related to the checkout block. Contributor Day - H1 2023 type: enhancement The issue is a request for an enhancement. type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team.

Comments

@nielslange
Copy link
Member

nielslange commented Feb 24, 2023

Problem

In #8531, @Moosinams mentioned that some Dutch cities can start with a single quote, for example 's-Hertogenbosch. While it's possible to place an order with 's-Hertogenbosch as city name, when placing a second order, the city name ‘s-Hertogenbosch appears in the Checkout block.

Steps to reproduce

  1. Add a product to the cart.
  2. Go to the checkout.
  3. Place the order with the following address:
Address         : Stationsplein 151
Country/Region  : Nederland
Postal code     : 5211 BP
City            : 's-Hertogenbosch
  1. Place another order.
  2. Verify that the prefilled city name appears as ‘s-Hertogenbosch.

Additional cities that start with an apostrophe:

  • ’s-Gravenhage (The Hague) - Netherlands
  • ’s-Hertogenrade - Netherlands
  • ’s-Heerenberg - Netherlands
  • ’s-Heer Abtskerke - Netherlands
  • ’s-Heer Arendskerke - Netherlands
  • ’s-Heerenhoek - Netherlands
  • ’s-Heer Hendrikskinderen - Netherlands
@nielslange nielslange added type: enhancement The issue is a request for an enhancement. type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team. block: checkout Issues related to the checkout block. labels Feb 24, 2023
@laurendavissmith laurendavissmith added this to the Contributor Day - New Checkout Flow milestone Apr 6, 2023
@laurendavissmith laurendavissmith removed this from the Contributor Day - Blocks Checkout milestone Apr 6, 2023
@wavvves
Copy link
Contributor

wavvves commented Apr 12, 2023

@nielslange In my opinion, we shouldn't prevent data from being escaped. Instead, decode the HTML entities or make sure the browser can parse them properly for displaying. It's highly likely this problem affects other fields 🤔

@Moosinams
Copy link

Moosinams commented Apr 13, 2023 via email

@nielslange nielslange changed the title Do not escape special characters when they are part of a city name Display special characters when they are part of a city name Apr 14, 2023
@nielslange
Copy link
Member Author

@nielslange In my opinion, we shouldn't prevent data from being escaped. Instead, decode the HTML entities or make sure the browser can parse them properly for displaying. It's highly likely this problem affects other fields 🤔

Good point, @wavvves. My primary intension was to ensure that city names with special characters are displayed correctly. I changed the title of this issue accordingly.

@nielslange
Copy link
Member Author

nielslange commented Apr 14, 2023

Dear Niels, Sorry to aks you in this way. I have a problem with the checkout-page. It gives error; invalid parameter owner[name]. Owner name must be at least 3 characters long. Hope you could help me using my email. I find it to difficult to pass it on github. Greetings Moos

Hello @Moosinams 👋

To avoid confusion, please create a separate issue for your question.

@dnusca
Copy link
Contributor

dnusca commented Apr 19, 2023

I'd like to pick this one up!

@dnusca
Copy link
Contributor

dnusca commented Apr 19, 2023

@nielslange I'm wondering at what level in the component hierarchy the HTML entities should be decoded?

We've got:

  • AddressForm
    -- ValidatedTextInput
    --- TextInput

I was going to decode the entities inside TextInput, but might there be a use case for displaying encoded html entities in a TextInput?

@nielslange
Copy link
Member Author

[...] I'm wondering at what level in the component hierarchy the HTML entities should be decoded?

Thanks for reaching out, @dnusca. Given the component hierarchy, decoding the HTML entities inside the TextInput component would be appropriate. This follows the general principle from both WordPress.org and WordPress VIP guidelines to escape data as late as possible.

@dnusca
Copy link
Contributor

dnusca commented Apr 19, 2023

Thanks. I've submitted a PR with the changes in the TextInput

@Moosinams
Copy link

Moosinams commented Apr 19, 2023 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: checkout Issues related to the checkout block. Contributor Day - H1 2023 type: enhancement The issue is a request for an enhancement. type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team.
Development

Successfully merging a pull request may close this issue.

5 participants