Skip to content

CRM: Fix special character display in task titles and descriptions for international users #44157

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

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

mikestottuk
Copy link
Contributor

@mikestottuk mikestottuk commented Jul 1, 2025

Proposed changes:

  • Fixes display of special characters (ì, ò, ù, À, È, Ì, etc.) in task titles and descriptions in the CRM list view and calendar view
  • Implements comprehensive HTML entity decoding to prevent double-encoding of Unicode characters
  • Adds decodeHTMLEntities() helper function to properly decode all HTML entities before display
  • Ensures proper international character support for multilingual CRM users

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Discussed here: p1749748624776009-slack-CL5UJ9ASE

Does this pull request change what data or activity we track or use?

No changes to data tracking or usage.

Testing instructions:

Before testing:

  1. Create a task with special characters in the title or description, such as:
    • Title: "Here is a for ì, ò, ù, À, È, Ì"
    • Description: "Test description with special chars: ì, ò, ù, À, È, Ì"

Test the fix:

  1. Go to CRM → Tasks → List View

    • Expected: Special characters should display correctly (ì, ò, ù, À, È, Ì) instead of HTML entities
    • Before: Characters appeared as ì, ò, ù, À, È, Ì
  2. Go to CRM → Tasks → Calendar View

    • Expected: Task titles with special characters should display correctly in calendar events
    • Before: Characters appeared as HTML entities
  3. Verify that other views (Edit, View) continue to work correctly (they were already working)

Test with different languages:

  • Try creating tasks with characters from various languages (French, Italian, Spanish, etc.)
  • Verify that all Unicode characters display properly in both list and calendar views

@mikestottuk mikestottuk self-assigned this Jul 1, 2025
@mikestottuk mikestottuk requested a review from Copilot July 1, 2025 09:38
Copilot

This comment was marked as outdated.

@github-actions github-actions bot added the [Plugin] CRM Issues about the Jetpack CRM plugin label Jul 1, 2025
Copy link
Contributor

github-actions bot commented Jul 1, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jul 1, 2025
@mikestottuk mikestottuk added [Status] Needs Review This PR is ready for review. [Type] Bug When a feature is broken and / or not performing as intended and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Jul 1, 2025
Copy link

jp-launch-control bot commented Jul 1, 2025

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report

@mikestottuk mikestottuk requested a review from Copilot July 1, 2025 09:43
Copilot

This comment was marked as outdated.

mikestottuk and others added 2 commits July 1, 2025 11:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mikestottuk mikestottuk requested a review from Copilot July 1, 2025 10:52
Copilot

This comment was marked as outdated.

@mikestottuk mikestottuk requested a review from Copilot July 1, 2025 10:58
Copy link
Contributor

@Copilot Copilot AI left a 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 the display of international special characters in task titles and descriptions by decoding HTML entities before rendering.

  • Implements a helper (decodeHTMLEntities) to decode HTML entities.
  • Updates task and list view JavaScript files to use the new decoding function with proper escaping.
  • Includes minor updates in the changelog and .gitignore to support the changes.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
projects/plugins/crm/js/jpcrm-admin-tasks.js Decodes task titles before escaping, ensuring correct tooltip content.
projects/plugins/crm/js/ZeroBSCRM.admin.listview.js Replaces direct escaping with a decode-then-escape function in titles and descriptions.
projects/plugins/crm/js/ZeroBSCRM.admin.global.js Adds the new helper functions for HTML entity decoding and combined escaping.
projects/plugins/crm/changelog/fix-crm-task-encoding Updates the changelog to reflect the fix for special character display issues.
projects/plugins/crm/.gitignore Adds new ignore rules for cursor rules files.
Comments suppressed due to low confidence (3)

projects/plugins/crm/js/jpcrm-admin-tasks.js:98

  • Confirm that using the decoded title (which omits the prepended timeText in non-'listMonth' views) for the tooltip is intentional and aligns with the desired UI behavior.
				'<div class="event_html" title="' + jpcrm.esc_attr( decodedTitle ) + '">' + html + '</div>';

projects/plugins/crm/js/ZeroBSCRM.admin.listview.js:4887

  • Ensure that the new escTextWithDecode function provides the same level of security and escaping as the original esc_html, especially in contexts where user input is rendered.
		jpcrm.escTextWithDecode( dataLine.title ) +

projects/plugins/crm/js/ZeroBSCRM.admin.listview.js:4898

  • Verify that applying escTextWithDecode for the description field maintains consistency with previous behavior and update tests if necessary to cover any edge cases introduced by the decoding logic.
	const td = '<td>' + jpcrm.escTextWithDecode( dataLine.desc ) + '</td>';

@mikestottuk mikestottuk requested a review from tbradsha July 1, 2025 11:04
@tbradsha tbradsha changed the title Fix special character display in task titles and descriptions for international users CRM: Fix special character display in task titles and descriptions for international users Jul 2, 2025
Copy link
Contributor

@tbradsha tbradsha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment about ignored files.

This solves the immediate problem. My bigger concern is that we're handling these differently than other objects by unnecessarily converting chars into entities for storage in the database for tasks; ideally we should be stripping tags, saving text as-is and then escaping on output.

Comment on lines +27 to +29
.cursor-rules.json
.cursorrules

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these added intentionally? Ideally ignored files would be files that are expected to exist, but it'd be odd to have these exist at the project level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] CRM Issues about the Jetpack CRM plugin [Status] Needs Review This PR is ready for review. [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants