close
Skip to content

Fix meta description UTF-8 character count#655

Merged
dkotter merged 5 commits into
WordPress:developfrom
yusufhay:fix/meta-description-utf8-character-count
Jun 5, 2026
Merged

Fix meta description UTF-8 character count#655
dkotter merged 5 commits into
WordPress:developfrom
yusufhay:fix/meta-description-utf8-character-count

Conversation

@yusufhay

@yusufhay yusufhay commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What?

Updates meta description generation to pass UTF-8 explicitly when calculating the generated description character count.

Why?

The generated meta description response includes a character_count value. Other multibyte length checks in the plugin already pass UTF-8 explicitly, and this keeps meta description output consistent for multilingual content.

How?

Changes the mb_strlen() call used for the generated meta description output from relying on PHP internal encoding to explicitly using UTF-8.

Use of AI Tools

AI assistance: Yes
Tool(s): Codex / ChatGPT
Model(s): GPT-5
Used for: Scanning the codebase for small correctness issues and drafting the minimal change. I reviewed the change and PR description before submitting.

Testing Instructions

  1. Install and activate this PR build of the AI plugin.
  2. Connect a provider that supports text generation.
  3. Enable the Meta Description experiment.
  4. Open or create a post with non-English / multibyte content.
  5. Generate a meta description.
  6. Confirm the generated result still appears normally and the returned character_count reflects the generated UTF-8 text.

Screenshots or screencast

Not applicable. This PR does not change the UI.

Changelog Entry

Fixed - Use explicit UTF-8 encoding for generated meta description character counts.

Open WordPress Playground Preview

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yusufhay <yusufmudagal@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.68%. Comparing base (64e8032) to head (24347af).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
...es/Abilities/Meta_Description/Meta_Description.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #655      +/-   ##
=============================================
+ Coverage      74.57%   74.68%   +0.10%     
  Complexity      1754     1754              
=============================================
  Files             85       85              
  Lines           7548     7549       +1     
=============================================
+ Hits            5629     5638       +9     
+ Misses          1919     1911       -8     
Flag Coverage Δ
unit 74.68% <0.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread includes/Abilities/Meta_Description/Meta_Description.php Outdated
@dkotter dkotter added this to the 1.1.0 milestone Jun 4, 2026
@dkotter dkotter merged commit e656047 into WordPress:develop Jun 5, 2026
24 of 26 checks passed
jorgefilipecosta pushed a commit that referenced this pull request Jun 15, 2026
Changed - Use explicit UTF-8 encoding for generated meta description character counts.

Co-authored-by: yusufhay <yusufmudagal@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants