I understand the constraint by ID specification. In this case idGenerator.generateUniqueId must remove all character not in [A-Za-z0-9:_.-] regexp and add -1 if we have twice the same heading
It will be simpler for user I think. ... or better (but more complexe for developper) replace "à" by "a", "ç" by "c" etc. I will propose that at JIRA. Thxs. ________________________________ De : "[email protected]" <[email protected]> À : XWiki Users <[email protected]> Envoyé le : Mercredi 28 mai 2014 17h25 Objet : Re: [xwiki-users] include problem with french characters Hi Pascal, Internally we generate an anchor id based on the heading text: /** * Generate a unique id attribute using the passed text as the seed value. The generated id complies with the XHTML * specification. Extract from <a href="http://www.w3.org/TR/xhtml1/#C_8">XHTML RFC</a>: * <p> * <code> When defining fragment identifiers to be backward-compatible, only strings matching the pattern * [A-Za-z][A-Za-z0-9:_.-]* should be used.</code> * </p> * * @param prefix the prefix of the identifier. Has to match [a-zA-Z]. * @param text the text used to generate the unique id * @return the unique id. For example "Hello world" will generate prefix + "Helloworld". */ public String generateUniqueId(String prefix, String text) Called with: id = idGenerator.generateUniqueId("H", text); This is why for the text “Level1 - Séct-io'n 4” we generate “HLevel1-SE9ct-io27n4" What we could do though is allow the user to enter the heading text instead of the id and generate the id internally. However there’s stil the issue that generateUniqueId will generate a unique id (if you have twice the same heading, the second heading id will have “-1” suffixed.. In any case I agree it’s not user-friendly for this use case but also when specifying the anchor in the wiki link syntax and you should open a JIRA issue IMO. Thanks -Vincent On 28 May 2014 at 14:50:28, Pascal BASTIEN ([email protected](mailto:[email protected])) wrote: > Hello, > > The include function is to hard to use with some non-us character like > french: éèà'ç ... > > > By example, I have a document with this section: > > = Level1 - Séct-io'n 4 = > > Bla bla > > if I want to include this section: "Level1 - Séct-io'n 4" I must use this > include > {{include reference="Pagefille2" section="HLevel1-SE9ct-io27n4"/}} > > I must replace special character with unicode code: > http://www.utf8-chartable.de/ > > I can use another way? > I must open a bug on http://jira.xwiki.org/ ? > > NB: anchor doesn't work with include. > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
