Revert "Remove unnecessary assignments in MatchPrefix"

This reverts commit f597c67cf2b0d107ebd82157431bdf69f8f66a36.
Fix bug of MatchPrefix

1. Add abstract method Match to Dict
2. Let MatchPrefix and MatchAllPrefixes be implemented in abstract class Dict
3. Rename UTF8Utils::Truncate to TruncateUTF8 and ensure whole UTF8 character