Hi,
I don't know whether this is already somewhere on this site. Many of you should already be knowing this. Or if there is better way let me know.
Anyway here is a tip to copy the text properly within code tags

1) Copy the code and paste it as it is in emacs
2) Select the pasted code
3) Type M-x replace-regexp [enter]
4) #C-q C-j [enter] [enter]

Thats it!!