Hello.
I have strange problem

I've made content type with field for AddThis->AddThis button.

If the field is OFF (not visible on content) everything is ok, but when I'm turning it on I've got this error below when/after visiting content with that filed.
In the teaser view I have turned off this field so no errors... but if I turn it ON... it's the same error but many times - because many teasers on front page (1 error for 1 content)

It doesn't matter if the view field is Basic Button or Basic Toolbox

Location http://totapodroz.pl/content/e <------- title after use of Transliteration from "ę" to "e"
Message Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1670 of /var/www/vhosts/4/112314/webspace/httpdocs/totapodroz.pl/includes/bootstrap.inc).

EDIT:
I forgot about important thing. This error show on only when node title contain chars like: ąęśćżłó

CommentFileSizeAuthor
#6 fix-umlauts-2644044-6.patch543 bytesmerilainen

Comments

totap created an issue. See original summary.

totap’s picture

Issue summary: View changes
totap’s picture

Issue summary: View changes
totap’s picture

Issue summary: View changes
totap’s picture

I have found the solution:

- open includes/bootstrap.inc

find your line:

function check_plain($text) {
  return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}

Replace with:

function check_plain($text) {
  if (!mb_detect_encoding($text, 'UTF-8', true)) {
        $text = mb_convert_encoding($text, 'UTF-8', 'ISO-8859-1');
  }
  return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}

Solution #13: https://www.drupal.org/node/1430166#comment-6647386

merilainen’s picture

Version: 7.x-4.0-alpha6 » 7.x-4.x-dev
Assigned: totap » merilainen
Status: Active » Needs review
StatusFileSize
new543 bytes

So maybe we have to use htmlspecialchars() instead of htmlentities()?

gisle’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, mErilainen - it works!

  • gisle committed 4aa17be on 7.x-4.x authored by mErilainen
    Issue #2644044 by mErilainen: Fixed warning htmlspecialchars
    
gisle’s picture

Priority: Major » Normal
Status: Reviewed & tested by the community » Needs review
Related issues: +#2803109: Double htmlentities encoded

Looks like this now causes the entities to be double encoded.

Removing the encoding altogether (see related issue #2803109: Double htmlentities encoded) seems to have no adverse effects, but if you've experienced this bug in the past, please review latest snapshot of 7.x-4.x branch to see if the latest change to this function has resulted in a regression.

chrbak’s picture

Hello,

I use the 7.x-4.0-alpha6 version and I have a title with Greek characters and the htmlentities() php function doesn't work correctly. I get at the popup share window of facebook a title with HTML entities e.g.
&Delta;&omicron;&mu;ή &Pi;&alpha;&rho;&omicron;&chi;ή&sigmaf; &Beta;&alpha;&sigma;&iota;&kappa;ώ&nu; &Alpha;&gamma;&alpha;&theta;ώ&nu;.

I changed the php function to htmlspecialchars() and now it works.

Thanks