Allow text strings containing newlines and carriage return to be processed.

Fix for #439 for the KeywordHandler implementation.
Tests for the 0c456b2ce09 commit towards the fix of issue #439