As you may already know, the Visual Basic Upgrade Companion (VBUC) is the premier tool for converting legacy VB6 applications to .NET.
One of the many scenarios that VBUC supports is the migration of applications containing non-ASCII characters. This is crucial for applications with strings or comments in languages such as Japanese, Chinese, or Hebrew.
Working with encodings, code pages, and regional settings can be complex and often requires a refresher. Scott Hanselman provides an excellent explanation of these basic concepts here: https://www.hanselman.com/blog/computer-things-they-didnt-teach-you-in-school-2-code-pages-character-encoding-unicode-utf8-and-the-bom.
Originally, Visual Basic stored these characters in Unicode, displaying them correctly in the VB6 IDE.
The VBUC generates code files using UTF-8, considering the developer’s regional settings to accurately convert the original characters into their UTF-8 representation.
However, if these settings are not configured correctly, you might end up with garbled text in the migrated application.
So, for a source like this one:
You might end up with this:
Or this:
The answer to this is to simply set the system locale to English during the conversion process, following these steps:
Now the generated code will be using UTF-8 and will work in any environment you move it to.
As usual, if you have any questions, feel free to reach out and book a session with us: https://www.mobilize.net/talk-to-an-engineer.