Topic-icon Οg:description-cannot share russian chars properly

Active Subscriptions:

None
10 years 10 months ago #33817 by dimtsa
Hi Helpdesk,

when I try to share a k2 item that includes particular russian characters, we get an inpropriate share, as you can see in this k2 item yoursself

www.agioritikovima.gr/russian/index.php/...09-17-43-49/item/471

Have you any suggestion? because I cannot find a solution at all.

Thanks again,

Dimitris
The topic has been locked.
Support Specialist
10 years 10 months ago #33832 by alzander
Dimitris,
The issue is actually due to the use of   That's getting encoded improperly and replaced with a funky character. We're aware of this issue and it will be fixed in a patch release we're hoping to have out next week.

Honestly though, the fix is the code we provided to you a while back in this post . Can you tell me if you're using that code on the site you mentioned above?

If you are using that code and still seeing the invalid characters, can you let me know how the Open Graph description is being set? Mainly, are you:
* Letting JFBConnect set it automatically
* Using an {SCOpenGraph description=xyz} tag on the page
* Configured an Open Graph - Content object for that category to set the description in some special fashion

Let me know the answers to the above and we'll gladly help diagnose things further if necessary.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 10 months ago #33841 by dimtsa
Hi Alex,

this piece of code already exists in our code

( // turn some HTML with non-breaking spaces into a "normal" string
$converted = htmlspecialchars(strip_tags($htmlText), ENT_QUOTES, 'UTF-8');
return $converted; ).

As far as the three other things, I cannot understand exactly what you mean, but I think JFBConnect set it automatically the description.

The proper is to post the description automatically from the k2 item.

How could change it?
The topic has been locked.
Support Specialist
10 years 10 months ago #33872 by alzander
Sorry for the delay. It's taken a bit to understand where something is going wrong, but we think we've figured it out. Our Open Graph system allows you to have the tags set in multiple different ways. The easiest way is to let it be set automatically, which is what it sounds like you've done. Other options just give you more control over what the description is set to for each article.

For the automatic settings though, we aren't passing the K2 text through that function that I had you modify a while ago. If you can make one more change, this will hopefully get you going. Please edit the /plugins/opengraph/k2/k2.php file. Around line 161, you'll see:
if ($desc_type == 'custom_desc_catwords')
                $desc = SCArticleContent::getFirstCategoryText($category, $desc_length, SC_INTRO_WORDS);
            else if ($desc_type == 'custom_desc_catchars')
                $desc = SCArticleContent::getFirstCategoryText($category, $desc_length, SC_INTRO_CHARS);
            $this->addOpenGraphTag('description', $desc, false);
Update that block by adding the extra line with SCStringUtilities right before the last line:
if ($desc_type == 'custom_desc_catwords')
                $desc = SCArticleContent::getFirstCategoryText($category, $desc_length, SC_INTRO_WORDS);
            else if ($desc_type == 'custom_desc_catchars')
                $desc = SCArticleContent::getFirstCategoryText($category, $desc_length, SC_INTRO_CHARS);

            $desc = SCStringUtilities::trimNBSP($desc);
            $this->addOpenGraphTag('description', $desc, false);
Hopefully that will fix the text as expected, but please let us know how it goes.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 10 months ago #33914 by dimtsa
Alex thank you,

but again, even if we do not use &nbsp, now the problem persists and i do not know why.

Some examples are

www.agioritikovima.gr/russian/index.php/.../item/514-org-lod-tb
www.agioritikovima.gr/russian/index.php/...512-shgshch-zhde-byu

Dimitris
The topic has been locked.
Active Subscriptions:

None
10 years 10 months ago #33915 by dimtsa
Alex thank you,

but again, even if we do not use &nbsp, now the problem persists and i do not know why.

Some examples are

www.agioritikovima.gr/russian/index.php/.../item/514-org-lod-tb
www.agioritikovima.gr/russian/index.php/...512-shgshch-zhde-byu

Dimitris
The topic has been locked.
Active Subscriptions:

None
10 years 10 months ago #34006 by dimtsa
Unfortunately, problem still exists...
:(
The topic has been locked.
Support Specialist
10 years 10 months ago #34034 by alzander
We're working to get the 5.0.1 bug-release of JFBConnect out next week and this is one of the issues we're focused on a lot right now to get in this release. We think we have some updated code that should fix multiple character issues and are testing it now. We'll try to provide it in the next day or so and would love to have your feedback on how it works for you.

Very sorry for the delay in this. PHP and HTML character encodings can be very tricky to handle in a wide-spread way and we want to get it so it works for as many users as possible with this release.

Thanks,
Alex
The topic has been locked.
Support Specialist
10 years 10 months ago #34081 by alzander
Dimitris,
Below is some updated code that we're testing. For us, it properly fixes UTF-8 characters as well as the nbsp; issues. If you could test, we'd really like to hear how it works for you.

To make the change, update the trimNBSP function in the /libraries/sourcecoast/utilities.php file around line 429. Update the function to be:
static function trimNBSP($htmlText)
    {
        // turn some HTML with non-breaking spaces into a "normal" string
        $converted = htmlentities(strip_tags($htmlText), ENT_QUOTES, 'UTF-8');
        $converted = trim(str_replace(' ', ' ', $converted));
        return $converted;
    }
You will still need the change to the k2 open graph plugin above to make sure this is called.

Please let us know how it goes. This change is scheduled for v5.0.1 due out next week. It's still being tested to make sure it works as expected and doesn't cause other problems though.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 10 months ago #34083 by dimtsa
Hi Alex,

many thanks fo your response.

Whato do you mean by "You will still need the change to the k2 open graph plugin above to make sure this is called. "?

Regards,

Dimitris
The topic has been locked.