none
TOC problem with Farsi/Persian language RRS feed

  • Question

  • Hello,

    I can not use TOC in Farsi/Persian language article. I have tried several times, but no any chance!

    Regards

    Tuesday, August 13, 2013 10:27 AM

Answers

  • I have previously found that foreign characters like "é í ç ã" are not recognized by the TOC feature. I am not surprised that Farsi/Persian characters are also not recognized.

    The workaround I use:

    1. Edit the article and select the "HTML" tab to edit the HTML.
    2. Use the "Find" button to search for all instance of "<h", which will find all headings (and also horizontal rules). Headings in the HTML begin with a tag similar to "<h1>" or "<h2>".
    3. If the TOC feature is used, each heading will have an anchor tag, similar to <a name="Introduction">. If the string in quotes has the zero character, "0", or foreign characters (like "é í ç ã"), then the heading will be ignored by the TOC feature. I assume the same applies to Farsi/Persian characters.
    4. Replace the problem characters with something else, or remove them.

    When you add the [toc] tag to an article, code scans the article when it is saved for all headings and adds an anchor tag to each one. The anchor tag has a name equal to the heading name, but with spaces and special characters replaced by underscores. The anchor tag name can be anything, as long as it does not include any "problem" characters, and the name is unique in the article. In your case, you may need to just replace the entire anchor tag name with an English string, just making sure the string is unique in the article. The heading string itself can be anything, with any characters.

    This is a workaround, not a fix, and it is not easy. Working in the HTML editor is not for everyone, and you have to be careful. This issue is mentioned briefly in the "Known Issues" Wiki, but I will update the article to make it clear that many foreign language characters effectively break the TOC feature (not just the "0" character).

    If you have a specific article in mind, you can link it here and I will "fix" the anchor name tags in the HTML. Or, you can attempt it yourself.


    Richard Mueller - MVP Directory Services

    Tuesday, August 13, 2013 3:12 PM
    Moderator
  • The TOC feature is implemented in code we get from a contractor called Telligent. I will ask Ed Price to bring it up with them. Also, we now have Russian, Chinese, and Portuguese versions of the Wiki, and I think they have the same problem. The articles I checked all have "Table of Contents" in English.


    Richard Mueller - MVP Directory Services

    • Marked as answer by Patris_70 Wednesday, August 14, 2013 1:09 PM
    Wednesday, August 14, 2013 10:27 AM
    Moderator
  • I found only the one heading in the article. In the anchor tag (in the HTML) I replaced <a name="سناریو"> with <a name="The_scenario">, but I assume it could have been any string without the foreign characters. Does it look correct now?


    Richard Mueller - MVP Directory Services

    • Marked as answer by Patris_70 Wednesday, August 14, 2013 1:09 PM
    Tuesday, August 13, 2013 10:27 PM
    Moderator

All replies

  • I have previously found that foreign characters like "é í ç ã" are not recognized by the TOC feature. I am not surprised that Farsi/Persian characters are also not recognized.

    The workaround I use:

    1. Edit the article and select the "HTML" tab to edit the HTML.
    2. Use the "Find" button to search for all instance of "<h", which will find all headings (and also horizontal rules). Headings in the HTML begin with a tag similar to "<h1>" or "<h2>".
    3. If the TOC feature is used, each heading will have an anchor tag, similar to <a name="Introduction">. If the string in quotes has the zero character, "0", or foreign characters (like "é í ç ã"), then the heading will be ignored by the TOC feature. I assume the same applies to Farsi/Persian characters.
    4. Replace the problem characters with something else, or remove them.

    When you add the [toc] tag to an article, code scans the article when it is saved for all headings and adds an anchor tag to each one. The anchor tag has a name equal to the heading name, but with spaces and special characters replaced by underscores. The anchor tag name can be anything, as long as it does not include any "problem" characters, and the name is unique in the article. In your case, you may need to just replace the entire anchor tag name with an English string, just making sure the string is unique in the article. The heading string itself can be anything, with any characters.

    This is a workaround, not a fix, and it is not easy. Working in the HTML editor is not for everyone, and you have to be careful. This issue is mentioned briefly in the "Known Issues" Wiki, but I will update the article to make it clear that many foreign language characters effectively break the TOC feature (not just the "0" character).

    If you have a specific article in mind, you can link it here and I will "fix" the anchor name tags in the HTML. Or, you can attempt it yourself.


    Richard Mueller - MVP Directory Services

    Tuesday, August 13, 2013 3:12 PM
    Moderator
  • Hi Richard,

    Thank you. Here is article link:

    http://social.technet.microsoft.com/wiki/contents/articles/18195.forest-admt-3-2-fa-ir.aspx

    سناریو is Scenario.

    I used this:

    <h1><a name="سناریو"></a><span style="font-size: 18px;"><a name="سناریو"></a><span style="font-size: 22px;">سناریو</span></span></h1>

    I did not find zero character, but no success!

    I used this too:

    <h1><a name="سناریو"></a><span style="font-size: 22px;">سناریو</span></h1>

    But no success,

    Here are Pics:

    If you have time, please check it.

    Thanks again

    Regards

    Add: I do not know, why added first automatic font-size: 18px then font-size: 22
    • Edited by Patris_70 Tuesday, August 13, 2013 8:44 PM add
    Tuesday, August 13, 2013 8:38 PM
  • I found only the one heading in the article. In the anchor tag (in the HTML) I replaced <a name="سناریو"> with <a name="The_scenario">, but I assume it could have been any string without the foreign characters. Does it look correct now?


    Richard Mueller - MVP Directory Services

    • Marked as answer by Patris_70 Wednesday, August 14, 2013 1:09 PM
    Tuesday, August 13, 2013 10:27 PM
    Moderator
  • Hi Richard,

    Thank you so much for your help, worked fine. You are awesome!

    Yes, for test, I used just one heading in the article, but I add all heading on sunday.

    Can you tell me, how can move TOC from left to right and how can I translate Table of Contents text to Farsi/Persian language. I can not find this text!

    Regards

    Wednesday, August 14, 2013 7:23 AM
  • The TOC feature is implemented in code we get from a contractor called Telligent. I will ask Ed Price to bring it up with them. Also, we now have Russian, Chinese, and Portuguese versions of the Wiki, and I think they have the same problem. The articles I checked all have "Table of Contents" in English.


    Richard Mueller - MVP Directory Services

    • Marked as answer by Patris_70 Wednesday, August 14, 2013 1:09 PM
    Wednesday, August 14, 2013 10:27 AM
    Moderator
  • Thanks Richard.

    Regards

    Wednesday, August 14, 2013 1:08 PM
  • Thursday, August 15, 2013 6:54 PM
    Moderator
  • Naomi, I notice that the Russian language article you reference does not have "Table of Contents" in English (or even in Russian). Is that because it is on the Russian Wiki? One of Patris_70's problems is that "Table of Contents" shows up in his Farsi language article.


    Richard Mueller - MVP Directory Services

    Thursday, August 15, 2013 8:50 PM
    Moderator
  • <h1><a name="سناریو"></a><span style="font-size: 18px;"><a name="سناریو"></a><span style="font-size: 22px;">سناریو</span></span></h1>

    Why the tag <a name="سناریو"></a> printed twice?

    I have the same issue/

    Saturday, August 17, 2013 6:44 AM
  • When a Wiki article is saved, a script runs that checks every heading, marked by the <h1> and </h1> tags (and similar for <h2>, etc.). If the heading does not have an anchor tag, marked by the <a name=xxx> and  </a> tags, then one is added using the text of the heading (with spaces and some characters replaced by underscores or similar).

    If the anchor tag name has the zero character, "0", or foreign characters, the TOC feature ignores it. The heading is not added to the Table of Contents. Unfortunately, when an article is saved, the script that adds anchor tags to all headings also does not recognize the zero character or foreign characters in the anchor tags (even though this script probably created them in the first place). The script thinks there is no anchor tag, so creates another with the same problem. Each time the article is saved, a new anchor tag is added. I've seen articles with a dozen identical anchor tags.

    When I "fix" a Wiki with a flawed TOC, I search for the string "<h" in the HTML editor to find all headings. If there are multiple anchor name tags in a heading, I delete all but one, just to remove the clutter. Then I modify the remaining anchor tag to eliminate all zero and foreign characters. It is not fun working in the HTML editor, but this fixes the TOC.

    A less common problem is duplicate <a name> tags  in the HTML. When this happens, two entries in the TOC will link to the same point in the article, because they have the same anchor tag name (the first wins). When you modify an anchor tag name, you need to be careful not to create a duplicate. If the TOC has duplicate headings, you many need to modify one or both anchor name tags in the HTML to make it work as expected.


    Richard Mueller - MVP Directory Services

    Saturday, August 17, 2013 4:01 PM
    Moderator
  • Thanks!

    It works manually.

    Saturday, August 17, 2013 7:46 PM