2017-02-14 07:28 PM
Posted on February 15, 2017 at 04:28
It seems STM32CubeMX can not handle well with UTF8 source file.
If my main.c is encoded in UTF8, regenerating code in
STM32CubeMX will lead to a scrambled mess. Characters above ASCII range are converted to gibberish, even if they are in user code section. It's nonsense.
https://community.st.com/s/topic/0TO0X000000BTr8WAG/stm32cubemx
2017-02-15 12:22 AM
Hello,
I will report your issue internally for more investigation and we come back to you as soon as possible.
Best Regards
Imen
2017-03-17 01:30 AM
Hello
pt.****
,Could you please send us the ioc you use when your reported this issue?
BR. Eric
2017-03-31 06:49 AM
Hello
pt.****
,I think it is not an issue with CUbeMX and more an issue with the IDE you use.
By any chance, are you using IAR?
Because, in fact, if you open directly the generated files with notepad++ (for instance), you will see that you don't have any
gibberish. However, when you open these same files with IAR, sometimes, we saw that some specific characters are changed by IAR.
Hope it will help you.
BR. Eric
2017-08-25 01:45 AM
Hello.
I am troubled with the same symptoms.
The version of CubeMX is 4.22.0.
The development environment is SW4STM32.
The reproduction method is explained below.
1. Generate the code with CubeMX.
2. Open the project with SW4STM32 and change the character code of the project to UTF-8.
3. Open main.c and add Japanese characters to the USER CODE area.
4. Quit SW4STM32.
5. Start CubeMX and generate the code again without changing anything.
6. When SW4STM32 is started and main.c is opened, it can be confirmed that garbled characters are occurring. You can also check garbled characters in the text editor.
From this, I think that CubeMX has the cause of garbled characters.
Is there a character code setting for CubeMX?
Best Regards
Yas
2018-04-06 10:31 PM
This issue doesn't occur on Mac,but occurs on Windows.
I think this issue is occurred by Default encoding.
Default macOS file encoding is UTF-8. But Default Windows file encoding is not UTF-8.
2018-04-08 02:41 AM
If you use CubeMX.exe(not Eclipse plugin), The solution is to add the
environment variable in Windows.
Variable name is _JAVA_OPTIONS .
Variable value is -Dfile.encoding=UTF-8 .
2018-08-17 01:23 AM
Hello,
I had the same problem on Windows.
In my environment, following environment variable is effective.
[Variable name] JAVA_TOOL_OPTIONS
[Variable value] -Dfile.encoding=UTF-8