lampak <llampak <at> gmail.com> writes:
I have tried encodeURIComponent before. Bażant królewski becomes Bażant_królewski. Diacritics are not converted. At least not under Firefox.
I don't know what you've tried, but the result of
encodeURIComponent('Bażant królewski')
is
"Ba%C5%BCant%20kr%C3%B3lewski"
in Firefox, and I'm pretty sure it works the same way on other browsers. (encodeURI is almost the same, but leaves more characters unencoded, which in this case is a bad thing.)
Then you need to replace %20 with _, % with ., unencoded characters ~!*()' with their proper utf-8 sequence, and you have the section title fragment.
(It might be a good idea to include a function doing that in wikibits.js, if there isn't one yet.)