Skip to content

Wrong OpenGraph Image URL Encoding of Non Latin Characters - In-Content Featured Image Only #38975

@mxhassani

Description

@mxhassani

Impacted plugin

Social

Quick summary

If the featured image of a post is taken from the content (not set explicitly via the editor), and this image title contains non latin characters (Ё, ﺡ, Ω, ש, 日, न..) the URL used for OpenGraph image og:image gets encoded to Latin-1 but the file title keeps its UTF-8 encoding, resulting in a 404 and empty social media thumbnails.

The issue doesn't happen if the image is manually set as the featured image of the post - the og:image URL remains in UTF-8.

Steps to reproduce

  1. Make sure Jetpack Social is On (Jetpack > Settings > Sharing)
  2. Create a new post
  3. Take an image and change its title to something containing non-latin characters, like: تجربه.png
  4. Add that image to the content of the post
  5. Publish the post
  6. Test by checking the HTML for og:image meta tag or by sharing the post.

A clear and concise description of what you expected to happen.

The image URL encoding to remain as UTF-8 and to link to the uploaded image.

What actually happened

The Encoding is changed to Latin-1 so the image URL becomes .../تجربÙ�.png instead of .../تجربه.png

Impact

Some (< 50%)

Available workarounds?

Yes, easy to implement

If the above answer is "Yes...", outline the workaround.

To rename all images used as thumbnails so they are in Latin characters
Or
To set a featured image manually on all posts
Or
Using a third-party tool to generate the social thumbnails like Yoast SEO

Platform (Simple and/or Atomic)

Atomic, Self-hosted

Logs or notes

It doesn't happen on Dotcom Simple sites because the image names are converted to Latin-1 then Hex on upload, affecting both the hosted file and the code.

8616758-zen

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugWhen a feature is broken and / or not performing as intendedCustomer Report [LEGACY]Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report"Triaged[Feature] PublicizeNow Jetpack Social, auto-sharing[Feature] SharingPost sharing, sharing buttons[Focus] i18nInternationalization / i18n, adaptation to different languages[Platform] Atomic[Plugin] JetpackIssues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/[Plugin] SocialIssues about the Jetpack Social plugin[Pri] Low

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions