The words are not getting displayed properly in the pdf even though they are getting displayed correctly in source file. And when I tried to copy words from the pdf file and paste them, they are pasted as what they should be (as they are in the source file) and not identical to pdf display. Example: The following content
"जिले का रहने वाला हूँ! मैने संगणक विज्ञान में स्नातक किया है|"
is getting displayed as:

I am working on ShareLatex website. I have configured xelatex in the settings. And I have defined the following in my latex file:
\usepackage{polyglossia}
\setmainlanguage[numerals=Devanagari]{hindi}
\setotherlanguage{english}
\usepackage{fontspec}
\newfontfamily\hindifont[ExternalLocation]{AnnapurnaSIL-R}
\setdefaultlanguage{hindi}

polyglossiaat hand, I would guess that you need to use[Script=Devanagari]when loading the font for it to work correctly. Alternatively, you can set up\devanagarifont, of course. – brian-ammon Jun 11 '14 at 19:39