Handle unicode literals properly in matrices

Fixes #7604
Merge pull request #7613 from clsn/str_unicode

Handle unicode literals properly in matrices