See
http://cikitsa.blogspot.in/2010/09/xelatex-velthuis-encoding-and-palatal.html
and the last comment .
Here are modified tex and pdf files based on the above, tested with
texlive2016. However, tilde does not get displayed in the english text.
ShreeDevi
If you base it on catcode changes it will never work in the argument
of another command, not just footnotes. There is no need to switch
catcodes.
leave ~ as active always and when you want it locally to be a normal ~ do
\edef~{\string~}
so the active ~ just expands to a non-active one.
David
For my purposes, the best way of solving this problem was to use the script
below, from Zdenek Wagner, from the discussion in the cikitsa website (thanks,
Dominik) (note that all I did was change \dev to \dn, for compatibility, and I
changed the name of the font:
\newfontfamily{\devanagarifont}