I have a multilanguage site. When giving a range of values to a text/select list using PHP code to translate its content and creating or editing a new node, it only shows the entries that doesn't have any special character. In the report error log it shows the error from the title for each element that fails the translation.
Everything worked correctly until the last update to the latest CCK (2.8).

For example I have the following in the PHP section of Allowed Values of a CCK field:

return array(
  'monumentos' => t('monuments'),
  'guia' => t('visit the city with a guided tour'),
  'cronologia' => t('chronology of Valencia')
);


The translations are:

  • monuments: monumentos
  • isit the city with a guided tour: visitar la ciudad con un guía
  • chronology of Valencia: cronología de valencia
  • When editing a content associated to this CCK Field it only shows the entries without any special character.
    In this particular example it shows:

  <select name="field_categoria_historia[value]" class="form-select required" id="edit-field-categoria-historia-value">
    <option value="monumentos">monumentos</option>
    <option value="guia"></option>
    <option value="cronologia"></option>
  </select>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

irean’s picture

I have the same problem. And maybe you're right - I updated CCK too. Did you try to return previous version of CCK?
And, by the way, my site isn't multilanguage.

laurent@usineb.com’s picture

I have the same problem. But it appear only if the view used to referenced node used the row style : field and if i put in the fields : title and Body.

If I use only the "title" field in the view, the problem doesn't appear.

My web site is multilingual.

L.

pixelpreview@gmail.com’s picture

I have a lot of warning in watchdog
htmlspecialchars(): Invalid multibyte sequence in argument ... in bootstrap.inc
after upgrade
I have a multilangual site portal in french and arabic
somebody has a solution ?

I will investigate this solution :
http://drupal.org/node/837322#comment-3617716

Anonymous’s picture

I have the same problem.
It's displayed only when I made "Page" at "View module".
My web site is multilingual.

I install an optional module in only CCK and Views in the following environment.

MySQL 5.0.51a
Apache/2.0.63 (Red Hat)
PHP 5.2.6

Drupal 6.19
Views 6.x-2.11
CCK 6.x-2.8

MaxMendez’s picture

Hi I have a same problem my url use ñ and show this errors:

warning: htmlspecialchars() [function.htmlspecialchars]: Invalid multibyte sequence in argument in C:\inetpub\drupal2\includes\bootstrap.inc on line 857.
warning: htmlspecialchars() [function.htmlspecialchars]: Invalid multibyte sequence in argument in C:\inetpub\drupal2\includes\bootstrap.inc on line 857.
warning: htmlspecialchars() [function.htmlspecialchars]: Invalid multibyte sequence in argument in C:\inetpub\drupal2\includes\bootstrap.inc on line 857.

Duke Nukem’s picture

Same problem for me when i add a Taxonomi term

dcdace’s picture

I had the same problem. I am using Drupal 6.20 (it was the same with D 6.19 too).
I got rid of "htmlspecialchars(): Invalid multibyte sequence in argument in /PATH/includes/bootstrap.inc on line 857" warning by replacing check_plain function with the same function from Drupal 6.16 bootstrap.inc file.

Respectively, I replaced this

function check_plain($text) {
  static $php525;

  if (!isset($php525)) {
    $php525 = version_compare(PHP_VERSION, '5.2.5', '>=');
  }
  if ($php525) {
    return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  }
  return (preg_match('/^./us', $text) == 1) ? htmlspecialchars($text, ENT_QUOTES, 'UTF-8') : '';
} 

with this

function check_plain($text) {
  return drupal_validate_utf8($text) ? htmlspecialchars($text, ENT_QUOTES) : '';
} 

Don't know how good it is to do it like this, but seems that it has worked fine.

xandeadx’s picture

Same problem

yched’s picture

Status: Active » Fixed
FileSize
467 bytes

I committed the attached fix to both 6.x-2.x and 6.x-3.x branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

brunorios1’s picture

Version: 6.x-2.8 » 6.x-2.9
Status: Closed (fixed) » Active

same problem here in 6.x-2.9...

the problem started when i added a nodereference field in a content type...

warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/brunorios/wshared/www/fipierredev/includes/bootstrap.inc on line 857.

brunorios1’s picture

brunorios1’s picture

Version: 6.x-2.9 » 6.x-2.8
pfrenssen’s picture

brunorios1, that is a bad solution which just suppresses the error message rather than fix the problem.

brunorios1’s picture

i agree... but i can't found the solution yet...

jlballes’s picture

Same problem!!

ChrisLaFrancis’s picture

Subscribe

nsciacca’s picture

FileSize
981 bytes

In addition, cck/content.module needs to be updated just like yched's fix:

content.module
line 766:        '#title' => isset($field['widget']['label']) ? check_plain(t($field['widget']['label'])) : '',
line 2407:      'label' => isset($field['widget']['label']) ? check_plain(t($field['widget']['label'])) : '',

I attached a patch, not really sure how to submit it for inclusion for the next release....

kscheirer’s picture

Status: Closed (fixed) » Needs review

If folks are still reporting this issue and writing patches, it doesn't look fixed to me.