Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
kreynen CreditAttribution: kreynen commentedI'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...
to...
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.
Comment #2
GaëlGActually 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.