Migrating ANSI Projects to UTF-8
LabWindows/CVI 2020 and later versions support both ANSI and UTF-8 encoding. Previous software versions only support ANSI encoding. Convert your ANSI project to UTF-8 using one of the following methods.
![]() |
Note LabWindows/CVI only supports file paths that are compatible with the System Codepage. |
Converting ANSI Projects to UTF-8
You can change the encoding of an ANSI project by selecting Edit»Project and specifying UTF-8 for the Encoding option or by selecting Options»Build Options and specifying UTF-8 for the Encoding option on the Build Process Options tab.
When you change an ANSI project to UTF-8, LabWindows/CVI converts your project configuration and the associated source code (*.c, *.h) and user interface (*.uir) files to UTF-8. For the source code files, LabWindows/CVI converts the file encoding to UTF-8. For the user interface files, LabWindows/CVI converts the encoding of the panels and menus to UTF-8.
After you change the project encoding to UTF-8, the CVI_UTF8 compiler define is added to the Predefined Macros. The CVI_UTF8 macro automatically resolves functions that take string parameters to the UTF-8 version of the function if the function has UTF-8 support. The UTF-8 version of the function is suffixed with Utf8 while the ANSI version is suffixed with Ansi. For example, SetCtrlAttribute resolves to SetCtrlAttributeUtf8.
![]() |
Note The CVI_UTF8 compiler define only resolves functions from LabWindows/CVI libraries with UTF-8 support. If your project includes third-party functions that offer both ANSI and UTF-8 support, call the UTF-8 version of the function. The LabWindows/CVI Readme provides information about which libraries have UTF-8 support. |
![]() |
Note Not all LabWindows/CVI or third-party libraries have UTF-8 support. If your project code calls functions without UTF-8 support, refer to Programming for UTF-8 Encoding for information on interacting with these functions. If your code handles all characters as single-byte characters, refer to Programming for UTF-8 Encoding for information on modifying your code to correctly handle UTF-8 encoding. The LabWindows/CVI Readme provides information about which libraries have UTF-8 support. |
Automatically Converting Pre-LabWindows/CVI 2020 Projects to UTF-8
LabWindows/CVI detects and allows you to automatically convert projects created in previous versions of LabWindows/CVI from ANSI to UTF-8 encoding on load. To enable the automatic conversion, go to Options»Environment and check the Convert projects to UTF-8 on load check box. When you load a project from a previous version of LabWindows/CVI, LabWindows/CVI launches a dialog box asking you if you want to convert the loaded project to UTF-8.
If you select Yes, LabWindows/CVI converts your project configuration and the associated source code (*.c, *.h) and user interface (*.uir) files to UTF-8. For the source code files, LabWindows/CVI converts the file encoding to UTF-8. For the user interface files, LabWindows/CVI converts the encoding of the panels and menus to UTF-8.
After you change the project encoding to UTF-8, the CVI_UTF8 compiler define is added to the Predefined Macros. The CVI_UTF8 macro automatically resolves functions that take string parameters to the UTF-8 version of the function if the function has UTF-8 support. The UTF-8 version of the function is suffixed with Utf8 while the ANSI version is suffixed with Ansi. For example, SetCtrlAttribute resolves to SetCtrlAttributeUtf8.
![]() |
Note The CVI_UTF8 compiler define only resolves functions from LabWindows/CVI libraries with UTF-8 support. If your project includes third-party functions that offer both ANSI and UTF-8 support, call the UTF-8 version of the function. The LabWindows/CVI Readme provides information about which libraries have UTF-8 support. |
![]() |
Note Not all LabWindows/CVI or third-party libraries have UTF-8 support. If your project code calls functions without UTF-8 support, refer to Programming for UTF-8 Encoding for information on interacting with these functions. If your code handles all characters as single-byte characters, refer to Programming for UTF-8 Encoding for information on modifying your code to correctly handle UTF-8 encoding. The LabWindows/CVI Readme provides information about which libraries have UTF-8 support. |