We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Wiki: Table of Contents for articles

Development and Programming

Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Alex, try changing line 113 from:

$str = preg_replace_callback("/\<h([1-6])\>(.+?)\<\/h\\1\>/si", array(&$this, 'create_toc'), $str);

to

$str = preg_replace_callback("/\<h([1-6])\>(.+?)\<\/h\\1\>/siu", array(&$this, 'create_toc'), $str);
       
alex7's avatar
alex7
130 posts
17 years ago
alex7's avatar alex7
Alex, try changing line 113 from: […]

Nop. No lack so far. The only browser it’s partially working (missing some characters in url) is Safari.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Hard for me to tell since I don’t know what was originally entered, but it appears to be working for me (using Safari). You’re right though, this will suffer the same problem that non-URL-safe characters present in many browsers, since the name anchors are based on that. What it really needs to be compatible is transliteration, that occurs with URL titles in weblog entries.

       
alex7's avatar
alex7
130 posts
17 years ago
alex7's avatar alex7
Hard for me to tell since I don’t know what was originally entered…

If you look at the page source, you can see:

<h4 id='�лавна�_��ани�а'>Главная траница</h4>
[...]
<h5 id='First_one'>First one</h5>
[...]
<h5 id='Second_one'>Second one</h5>
[...]
<h5 id='�е�в�й_под�аздел'>Первый подраздел</h5>
[...]
<h5 id='��о�ой_под�аздел'>Второй подраздел</h5>
[...]
<h5 id='Third_one'>Third one</h5>

Normal code should be without any “?” in headers, like this:

<h4 id='Главная траница'>Главная траница</h4>
[...]
<h5 id='First_one'>First one</h5>
[...]
<h5 id='Second_one'>Second one</h5>
[...]
<h5 id='Первый подраздел'>Первый подраздел</h5>
[...]
<h5 id='Второй подраздел'>Второй подраздел</h5>
[...]
<h5 id='Third_one'>Third one</h5>

The most interesting part, that in Mediawiki the same native characters are perfectly shown in any browsers. So I presume that there is something wrong in script code.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

I have not looked to see how Mediawiki parses their table of contents, but since I wrote this plugin from scratch, I doubt they are similar approaches. Unfortunately, it’s just not something I considered when writing it over a year ago. I do some a few other PCRE uses that would need the same modification that I suggested above, though. Email me (not PM please), referencing this thread, and I’ll send a new file over to you that might be a bit closer to what you’re after.

       
alex7's avatar
alex7
130 posts
17 years ago
alex7's avatar alex7

Thank you Derek for your time and sorry to bother you with the same (or similar) problem over and over again. :red:

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Thank you alex7 for your feedback and testing. I have updated the plugin in the add-on repository to version 1.1 for anyone else who needs utf-8 compatibility in their headings.

       
1 2 3

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.