Issue Details (XML | Word | Printable)

Key: MDL-9147
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Nicolas Connault
Reporter: Eloy Lafuente (stronk7)
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Fix tidy filter behaviour

Created: 01/Apr/07 09:33 AM   Updated: 03/Apr/07 04:48 PM
Return to search
Component/s: Filters
Affects Version/s: 1.6.5, 1.7.2, 1.8
Fix Version/s: 1.6.6, 1.7.3, 1.8.1

File Attachments: 1. File test.php (2 kB)

Environment: PHP5, tidy filter running

Database: Any
Participants: Eloy Lafuente (stronk7) and Nicolas Connault
Security Level: None
Resolved date: 03/Apr/07
Affected Branches: MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE
Fixed Branches: MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE


 Description  « Hide
After getting crazy last days with one Spanish moodler about how his site was showing accents and other chars (only in some places, apparently in a random fashion) I discovered that it had the tidy filter enabled and running.

So, one simple string like this:

'áéíóú'

after being processed by format_text() is showed in browser like:

áéíóúñÑ
(enclosed by html <p> tags in source code)

It seems that tidy breaks things sometimes... :-(

To reproduce:

1) Enable tidy filter (ensure you've installed the PHP5 tidy extension (tidy_repair_string).
2) Copy the attached test.php to your moodle dirrot.
3) Invoke it from the browser.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Eloy Lafuente (stronk7) added a comment - 02/Apr/07 04:00 PM
...confirmed in Spanish forums:

it seems that, by default the tidy_repair_string() function works with ascii (or iso-8859-1). But it has one third parameter that allows to specify the desired encoding.

Just change the function call from:

$text = tidy_repair_string($text, $tidyoptions);

to

$text = tidy_repair_string($text, $tidyoptions,'utf8');

And everything should work perfectly.

Note that, under 1.6 & 1.7 we need to ask for $CFG->unicodedb before setting than parameter, while under 1.8 and HEAD we can apply it directly.

Ciao


Nicolas Connault added a comment - 03/Apr/07 04:48 PM
All done!