Hello,
I am a beginner with Code::Blocks and have recently ran into a problem which I can not seem to resolve. The actions that I do until the problem occurs goes something like this:
1. I open up Code::Blocks;
2. I write some code (using foreign Lithuanian letters "ą, č, ę...");
3. I save & exit;
4. Problem. After opening the .cpp file the Lithuanian letters change into other ones. (For example: 'ą' changes to 'à'; 'č' changes to 'è'; etc.).
Why is this? How do I fix it? I'm guessing the problem is in my code. When the problem occurs, the code goes from this:
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
setlocale(LC_ALL, "Lithuanian");
cout << ("Ąą Čč Ęę Ėė Įį Šš Ųų Ūū Žž") << endl;
return 0;
}
to this:#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
setlocale(LC_ALL, "Lithuanian");
cout << ("Àà Èè Ææ Ëë Áá Ðð Øø Ûû Þþ") << endl;
return 0;
}
The 'setlocale' is there so that the Lithuanian letters wouldn't turn into unknown (for me) symbols when i build and run the code, so I must also use system default file encoding.
I couldn't find anyone with a similar problem in the forums, sorry if this is post is purposeless.
Thank you.
Try saving your source files in Unicode (ie. UTF-8) format.
You can do this wiht Edit->File encoding->UTF-8
While this saves all the written code and everything looks great, when I run it, the console prints symbols instead of the normal letters:
From
Aą Čč Ęę Ėė Įį Šš Ųų Ūū Žž
To
Ä„Ä Ä?Ä? Ä?Ät Ä-Ä- Ä®ÄÆ Å Å
Any other ideas?