TextDocument: lazily convert substitution mapping to unicode
This way, the substitution mapping method can return a dynamic mapping, the only requirement is to implement __getitem__ ne use case is to be able to use the same substitution script for different CRM notification messages and only compute the "heavy" substitution variables when they are actually needed. See !1047