all pages in utf-8
but only latin characters displayed in toc
need fix!
Example - http://my.ukrweb.info/vidnovlennya-robotozdatnosti-windows-nt-2000-xp-vista

Comments

deviantintegral’s picture

Status: Active » Postponed (maintainer needs more info)

It seems to be working for me (Opera 9.5 on OS X). Can you provide a screenshot, and can you check the source to see if the characters are showing in there but aren't being rendered by the browser?

Thanks,
--Andrew

podarok’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new12.41 KB

In attachement - screenshot...
You can use text from my site (upper) for testing 8)) (cause drupal.org unsupporting cyrillic in comments 8(( )

When using cyrillic in first h1 - sometimes it works well
But if one latin word used in toc(in any place) - some of h1-6 not rendered 8(

And title: Table of contents;
When using Cyrillic Table of contents - it never shows - rendered only "Table of contents' as default defined(at screenshot - localized version via drupal module "Localization")

Nice to see fix...

dami’s picture

Same problem here that utf-8 titles are not recognized, because it only expects titles consists of letter A-z, number 0-9 and spaces. A quick fix is change line 91 of tableofcontents.module from

  preg_match_all('/([A-z]+): ?([A-z0-9 ]+);/', $options_str[1][0], $options, PREG_PATTERN_ORDER);

to

  preg_match_all('/([A-z]+): ?(.*?);/', $options_str[1][0], $options, PREG_PATTERN_ORDER);

Not sure if it opens any security problem, I am not an expert on it. But the string goes through t() function at line 135, so I guess it's ok then.

dami’s picture

        $toc_options["title"] = t($toc_options["title"]);

This is probably not a proper use of t() function. IIRC, the user defined title string won't be translatable by locale module. We may want to remove this line and just check_plain() at output.

deviantintegral’s picture

StatusFileSize
new821 bytes

I'm thinking that a better solution would be to just allow any character other than a semicolon. Can you try the attached patch and let me know how it works?

I don't think there's a problem with the t() call - others haven't had problems, and I don't see any warnings about t() containing variables in the documentation.

Thanks,
--Andrew

deviantintegral’s picture

Priority: Critical » Normal

I have no idea if #5 is still relevant, but I'm marking this as normal to remove it from my critical queue.