Hello, i'm trying to display monster names on a qt gui but there are some special characters like "á, é, í, ó, ú and ñ" that are not being displayed correctly, does anyone know how to fix it? I've tried to google for a solution but most of the things i've found are related to console changes.
Uhm but isn't char strings already UTF-8? Sorry if this might looks like a very beginner question xD
Edit: so i've tried printing the names on a MessageBox and it was showing correctly there so the problem might be on the QString that is not on UTF-8 right? I've tried to use the method QString::fromUtf8() but didn't work
This is how im reading the char string:
Code:
MessageBoxA(NULL, mob->MonsterNamePtr->name, "", 0); // This shows correct name
ui->listWidget_2->addItem(mob->MonsterNamePtr->name); // This shows incorrect name
The strings in game are encoded with your default windows encoding (which is used by MessageBoxA), the QString operates on utf-8, you can use the QString::fromLocal8Bit to convert the native encoded char* to utf-8 QString
Heya, now im trying to read/write stuff to a file and im facing the next issue, when i write to a file from a QString the entity name is being saved and displayed correctly on the file but when I read that same name from the file and try to convert it to a QString using QString::fromLatin1 or QString::fromLocal8Bit characters like "á, é, í, ó, ú" are not being displayed correctly.
std::ofstream ofile;
// Open the file for writing
ofile.open(filename.toStdString().c_str(), std::ofstream::out | std::ofstream::trunc);
// Error check
if (!ofile.is_open())
{
MessageBoxA(NULL, "Failed saving the file.", "Error", MB_ICONERROR);
return;
}
// Write to the file
// Imagine we have something like QString entityname = "Dánder"
ofile << entityname.toStdString();
// Close the file
ofile.close();
QFile file("out.txt");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
return;
QTextStream out(&file);
out << "The magic number is: " << 49 << "\n";
Else try it with std::wstring instead of std::string.
Qt has everything you'll need. Really everything. Even 3D stuff / game rendering / Microcontroller etc... When I used it I never had one row with STD-library stuff.
Beginner Java: Displaying a 2D background 02/19/2012 - Tutorials - 0 Replies Displaying a 2D Background
Difficulty: 2 / 10.
Assumed Knowledge: basic knowledge of the Java language.
Information: This tutorial will teach you how to create a basic API and display an image.
What is an API..?
An application programming interface (API) is an interface implemented by a software program that enables it to interact with other software. It facilitates interaction between different software programs similar to the way the user interface facilitates interaction between...
C# displaying charname problem 04/08/2011 - SRO Coding Corner - 5 Replies Hey guys,
I've got some problems at the moment, im creating a information bar , or how to call it that shows my HP and MP and name ect ect...
But at the moment it only display the first letter of my name and servername, sometimes it shows everything and sometimes it shows nothing ...
Here is the code for my char name
string charactername = mem.ReadString(0xF9E9B8);
[Question]Displaying Packets 01/11/2009 - CO2 Private Server - 1 Replies just asking how to put that option back in there to display packets in the console
Help is appreciated and THanx