6 years ago.

Unicode Characters Incorrect When Using Serial.printf?

Hi,

I'm using mbed Serial(USBTX, USBRX) on a Nucleo-F411RE to communicate with a PC application (UWP for Windows 10). I'm getting strange exceptions out of Visual Studio which appear to be the fault of the mbed output via Serial. It says the following:

"No mapping for the Unicode character exists in the target multi-byte code page."

Which basically just means there are characters here which are not encoded the way I was expecting. This code worked! There's nothing unusual about the usage, other than some threading. But i'm using mbed-os 5.9 so the recent 5.10 serial interrupt lock issue doesn't cause problems. The encoding output is default and the encoding input to Visual Studio's App is default (UTF-8?).

I compiled again the other day and the problem went, but now it's back and seems like it's staying. I only have this issue with mbed but I cant track it down. Seems random, some people have it occur, some don't.

Any ideas?

Thanks.

Update: Issue doesn't occur on OS2.

posted by Angus Hutton-McKenzie 21 Nov 2018

Update: It's now happening in OS2 also... Is there a way of forcing encoding format in the Serial object?

posted by Angus Hutton-McKenzie 07 Dec 2018
Be the first to answer this question.