I worked it out.
Instead of inserting the Code with CTRL-V, insert it with CTRL-SHIFT-V. This removes any formatting inside the clipboard before pasting it to the textfield of a program.
I tried many different programs to copy the code from, and also tried to convert my source to different codings, but nothing works. Please help, I need to get this code into my document