cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX UTF8 source file merge bug

PT Wang
Associate

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

7 REPLIES 7
Imen.D
ST Employee
Posted on February 15, 2017 at 09:22

Hello,

I will report your issue internally for more investigation and we come back to you as soon as possible.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Jeanne Joly
Senior III
Posted on March 17, 2017 at 09:30

Hello

pt.****

,

Could you please send us the ioc you use when your reported this issue?

BR. Eric

Jeanne Joly
Senior III
Posted on March 31, 2017 at 15:49

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

Anju Hirano
Associate II
Posted on August 25, 2017 at 10:45

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

Juichi Ninomae
Associate
Posted on April 07, 2018 at 07:31

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.

Juichi Ninomae
Associate
Posted on April 08, 2018 at 11:41

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 .

tyama
Associate

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