Since I didn't find anything useful Googling, I decided write this short note.
When you get "unexpected char: 0xFFFF" from your Jenkinsfile (or any Groovy script), it basically means "Parse Error: Unexpected End of File". This is because Groovy's parser is implemented with Antlr that uses Unicode noncharacter U+0FFFF (link to pdf) to signal end of file.
In my case the problem was that I hadn't quoted a string. In retrospect the issue is obvious. When specifying environment variables, the values has to follow Groovy syntax i.e. strings need quotation marks unlike in shell.