Fix an infinite loop with the message box

Still need a more general fix for things setting endindex to INT32_MAX.
Merge pull request #390 from runrevfraser/refactor-syntax_unicode_fix_msgbox

Fix an infinite loop with the message box