-
Notifications
You must be signed in to change notification settings - Fork 3
529-formbuilder-encoding-issue #404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR updates the FormBuilder widget to decode HTML entities for dropdown options and submitted values, ensuring accented characters render and validate correctly. Class diagram for updated FormBuilder dropdown handlingclassDiagram
class Form {
- buildForm(): void
- validateForm(): void
}
%% Highlight changes in buildForm and validateForm
Form : +html_entity_decode for dropdown values in buildForm
Form : +html_entity_decode for submitted dropdown value in validateForm
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ilaria-orlando - I've reviewed your changes - here's some feedback:
- Always pass the correct charset (e.g. 'UTF-8') to html_entity_decode so French accents are handled properly in multi-byte contexts.
- The dropdown value/label decoding logic is duplicated between buildForm and validateForm—consider extracting it into a shared helper to keep transformations consistent.
- Right now keys remain encoded while labels are decoded, which can make the strict array_search brittle; normalize both sides the same way so lookups always match.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Always pass the correct charset (e.g. 'UTF-8') to html_entity_decode so French accents are handled properly in multi-byte contexts.
- The dropdown value/label decoding logic is duplicated between buildForm and validateForm—consider extracting it into a shared helper to keep transformations consistent.
- Right now keys remain encoded while labels are decoded, which can make the strict array_search brittle; normalize both sides the same way so lookups always match.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an encoding issue with HTML entities in FormBuilder widgets, specifically addressing problems with accented characters in dropdown options and form submissions.
Key changes:
- Decode HTML entities for dropdown option labels during form building
- Decode HTML entities for submitted values during form validation for dropdown, checkbox, and radiobutton fields
- Map encoded values to their decoded counterparts for proper display and validation
Summary by Sourcery
Bug Fixes: