DrawText behaves differently on sim/device (C API)

When trying to display Japanese text in the C API, I noticed that I was getting completely different results on device/sim based on character encoding and whether or not I use strings/wide strings.

Test code:

Result on device:

Result on sim:

1 Like

I saw your post on discord; you're on Windows right? What's the encoding of your source file? What compiler are you using?

Thanks for the reply. I'm on Windows 11, files are encoded in UTF-8 BOM (although I tried with no BOM as well). Using Visual Studio 2022.

Ran into this one today, same behavior as Nnnn

additional data point is that mac simulator shares the device behavior

Do all these strings render correctly on device? The way windows treats encoding is much different than the Mac so it's not surprising this doesn't work when embedding unicode characters directly into source files.

EDIT: After talking to another engineer and looking in to this issue I got different results than you are seeing (and my results matched the device):

  1. The PD API doesn't support wide strings, so L"" string will not work
  2. Works as expected, a UTF8 string using draw UTF8 encoding constant
  3. Wide string, won't work
  4. UTF8 encoded string being told to draw using UTF16 encoding, won't work

How did you type these strings into the editor? Are they UTF16 and not UTF8? I'm using VS Code with UTF8 file encoding.