Why does MATLAB crash with the message "mxCreateString called with non-UTF-8 input" in R2022a and newer releases?

13 ビュー (過去 30 日間)
I recently upgraded to R2022a or later. However, MATLAB crashes for various workflows, and the crash report shows a failed assertion with the message "mxCreateString called with non-UTF-8 input". The same code was working fine in older versions of MATLAB.
Here is a snippet from the crash log:
Assertion in struct mxArray_tag *__cdecl `anonymous-namespace'::MxCreateStringNCharsT_safe<char>::operator
()(const char *,const char *,unsigned __int64) const at B:\matlab\foundation\matrix\src\matrix\array2.cpp line 500:
mxCreateString called with non-UTF-8 input: ß-phase


MathWorks Support Team
MathWorks Support Team 2024 年 3 月 1 日
編集済み: MathWorks Support Team 2024 年 3 月 1 日
In the MATLAB R2022a release, an internal change was introduced that may lead to a crash accompanied by the error message: "mxCreateString called with non-UTF-8 input." This message indicates a compatibility issue with non-UTF-8 encoded data.
We have compiled a list of scenarios known to provoke the assertion, along with corresponding workarounds. Detailed resolutions and updates can be found in the associated bug reports.
  1. Reading XLS files containing invalid UTF-8 characters read with 'xlsread' in 'basic' mode can cause MATLAB to crash (Bug Report 3138975).
  2. Loading a MAT file created with a third-party tool that contains non-UTF-8 encoded strings (e.g. variable names, field names). Note that MAT files exported from MATLAB should not include any unsupported characters.
  3. Connecting to a Raspberry Pi that uses non-UTF encoding. To resolve this, go to Raspberry Pi Configuration settings->Localisation->Locale->Set locale button. Ensure that the character set is set to UTF-8.
  4. Connecting to a camera that has non-ASCII character property values might cause MATLAB to crash (Bug Report 2988516).
  5. Calling an external shared library (for example DLL) using "loadlibrary" and "calllib" in MATLAB, and a non-UTF-8 encoded string is passed to MATLAB. To work around this issue, contact the author of the DLL and request them to modify the source code so that the DLL returns UTF-8 encoded strings, ensuring compatibility with MATLAB R2022a and beyond.
  6. The 'insertText', 'insertObjectAnnotation', and 'listTrueTypeFonts' functions cause a MATLAB crash for non-UFT-8 fonts (Bug Report 2784831)
  7. Haver Analytics database data requests crash MATLAB (Bug Report 2851278)
If your use case is not listed above, or you need further assistance or information, please contact MathWorks Technical Support with reproduction steps and code:

その他の回答 (0 件)


Help Center および File ExchangeProgramming Utilities についてさらに検索




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by