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__
This way, the substitution mapping method can return a dynamic mapping, the only requirement is to implement __getitem__