On 24/08/10 15:25, Tgr wrote: > lampak<llampak<at> gmail.com> writes: > >> Hi. I'm working on a script which edits a page, adds a section to it and >> then redirects to this page. >> >> It would be nice if it went straight to the newly-created section. So I >> need to create a link with # in it. >> >> The problem appears when the title of the section contains some >> diacritics. For example, link to "bażant królewski" looks like >> "Ba.C5.BCant_kr.C3.B3lewski". >> >> How can I generate in JavaScript such a link which would be identical to >> the one generated by MediaWiki? Has somebody written such a function? Or >> at least, do you know where it is done in MediaWiki php code? > > It is pretty simple as long as there is no wikitext or html in the title: > convert it to urlencoded UTF-8 (encodeURIComponent does that), replace percent > signs with dots, replace spaces with underscores. I have tried encodeURIComponent before. Bażant królewski becomes Bażant_królewski. Diacritics are not converted. At least not under Firefox.
lampak _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
