About Store Forum Documentation Contact



Post Reply 
Text encoding broken when reading from file
Author Message
Outdoordoor Offline
Member

Post: #1
Text encoding broken when reading from file
I'm trying to read from a text file (either xml, or json) which contains text written in both latin and cyrillic letters. However, cyrillic letters, along with some special symbols, are not read correctly, and I'm getting results like this:
[Image: pKDcxEK.jpg]

Test code for xml files looks like this:
Code:
XmlData xml;
if(!xml.load(UID(329369827, 1286683127, 1145043378, 2659162026)))
{
   LogConsole(true); Log("Failed to load file");
}
REPA(xml.nodes)
{
   LogConsole(true); Log(S+xml.nodes[i].name+"    "+xml.nodes[i].findParam("en").asText()+'\n');
}

What can I do to fix this? I've already tried using many different file encodings. Also this is not just an issue with the terminal output, the same happens when I try drawing text on screen.
02-15-2024 07:12 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Text encoding broken when reading from file
File should have UTF8 BOM at the start.
https://en.wikipedia.org/wiki/Byte_order_mark
02-15-2024 09:16 AM
Find all posts by this user Quote this message in a reply
Outdoordoor Offline
Member

Post: #3
RE: Text encoding broken when reading from file
Seems like it helped, thank you!
02-15-2024 10:39 AM
Find all posts by this user Quote this message in a reply
Post Reply