Encode URI components when sending lines to the backend

Fixes #41.