When I create a text ad an write international character in the Ad header or in the Ad body it displays wrong character:

1 semana y 2 días de promoción ---> 1 semana y 2 días de promoción

I've downloaded the last version.

CommentFileSizeAuthor
#4 ad.install.txt7.67 KBnomad@drupal.ru

Comments

jeremy’s picture

Priority: Normal » Critical

In general, the ad_text module needs some love to escape all special characters properly for use with JavaScript. For example, simply using a single quote in your text ad will cause it to not be displayed at all.

Bumping the priority to critical.

laghalt’s picture

Got the same problem - it seems like the module ignores that drupal uses utf-8 characters - interpret the utf-8 codes as iso-8859-1 and then translate it into html entities. Only place in drupal that this ocurs.

jeremy’s picture

Assigned: Unassigned » jeremy
Status: Active » Fixed

Calls to htmlentities in both the ad_text and ad_image module have been fixed to use UTF-8 for proper international character support when displaying ads. This fix has been checked into both the 4.7.x and 5.x development trees and will be part of -beta9.

nomad@drupal.ru’s picture

StatusFileSize
new7.67 KB

It's not working for me =)
I downloaded official release 5.x-1.0-1 (2007-May-04, http://drupal.org/project/ad).

I modifyed ad.install with the following:


/**
 * Patch by nomad.
 * Change collation and character set of tables to provide compatibility with drupal (and Russian language =))
 */
function ad_update_3() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    default:
      $ret[] = update_sql("ALTER TABLE {ads} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_clicks} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_groups} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_hosts} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_image} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_image_format} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_owners} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_permissions} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_statistics} CONVERT TO CHARACTER SET utf8");
      $ret[] = update_sql("ALTER TABLE {ad_text} CONVERT TO CHARACTER SET utf8");
  }
  return $ret;
}

Then found the following: using show table status like 'ad%' we can see, that collation for all ad* tables is set to utf8_general_ci, then running administer -> modules, installing all ad* modules, modules create tables, trying to issue text-ad and looking at "?"-questions instead of text (I meant that we published text-ad and see only "?"). =)

Then going back to mysql console and we can see, that for tables {ad_text}, {ad_image} and {ad_image_format} collation changed to latin1_swedish_1 again =)
Doing alter table {*} convert to character set utf8 and voila - everything seems to be ok now...

jeremy’s picture

Status: Fixed » Active

Thanks nomad, I'm re-opening this issue to remind me to merge in this fix.

nomad@drupal.ru’s picture

Thanks, Jeremy! I do really appreciate a bunch of work on this module you've done!

jeremy’s picture

Status: Active » Fixed

Fix committed to the 4.7.x and 5.x development branches.

Anonymous’s picture

Status: Fixed » Closed (fixed)