I'm using cc-module in a german drupal installation.
On admin/settings/creativecommons/default the description text for the Default jurisdiction shows wrong encoding.

First I searched drupal translations without any result;
then I realized that on line 345 in creativecommons.module this description text is called through cc-api.

I changed this line (345) from...

    '#description' => $q['jurisdiction']['description'],

...to...

    '#description' => utf8_decode($q['jurisdiction']['description']),

This solves the problem for me.
But I haven't looked any deeper. I guess there are more lines that should be patched this way.

Comments

kreynen’s picture

Status: Active » Postponed (maintainer needs more info)

I'd like to fix this a little further upstream if possible since that same code is used in the creativecommons_user function as well. I also want to avoid creating problems for other languages. In what I've read about utf8_decode, it can fix one language but cause problems for another.

Are you using PHP4 or PHP5? According to the documentation, xml_parser_create() in PHP5 should auto detect a utf-8 feed.

http://php.net/manual/en/function.xml-parser-create.php

If you are using PHP4, try changing setting the xml_parser_create() to xml_parser_create('utf-8') around line 1285. Change...

function creativecommons_get_questions_array($license_id) {
  $question_xml = creativecommons_get_questions_xml($license_id);
  $parser = xml_parser_create();

to...

function creativecommons_get_questions_array($license_id) {
  $question_xml = creativecommons_get_questions_xml($license_id);
  $parser = xml_parser_create('utf-8');

That variable is ignored in PHP5.

Also, do I need to have default language in Drupal set to German as well? I've selected de from the list of jurisdictions and cannot reproduce the issue.

GaëlG’s picture

Version: 6.x-1.0-rc1 » 6.x-1.0-beta4
Status: Postponed (maintainer needs more info) » Needs review

Actually I got the same problem in french. Every string from xml parsing displayed wrong characters for accents. I'm using PHP5 though. xml_parser_create('ISO-8859-1') worked like a charm, xml_parser_create('UTF-8') did not.