I guess I'm not getting where the problem is happening. What happens if you connect with a command line type front end and select the data, is it correct then?
Also, have you tried putting something like <plaintext> at the beginning of your script to make sure the really are getting chopped up?