Download

C++ Unicode Variable to FString Cast Error, Why?

I’m trying to convert a string I receive via HttpRequest with special characters and accentuation … I managed to convert the result to a variable in C ++ successfully, but when I convert to FString using the forum answers or the answers I found but I still receive invalid characters … can anybody help me?
thanks…

Can you verify what the values actually are? You should be able to use the Memory window in Visual Studio to look at the hex codes.

Once you have that, go through a checklist like this:

  1. Are the characters being sent by the HTTP server as UTF-8? Generally you’d see two bytes per special character, but it could be more. This is a description of the format: UTF-8 - Wikipedia
  2. Are the characters being sent using some other codepage like ISO-8859 or UTF-16 or something else? In that case you may need a different conversion, depending on which one.
  3. Once you have the characters correctly in UTF-8, verify that any copying you’re doing is preserving them (it should)
  4. Finally, it could be that printing the characters in the log/debug window is not showing UTF-8 characters properly, so make sure you test the actual use.