Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Portuguese accent showing in display

This thread is locked; no one can reply to it. rss feed Print
Portuguese accent showing in display
Bruno Guerra
Member #15,337
October 2013

Hello guys, I've never used a forum before, I always search for an answer to a problem, but this time.. Has been more than a half week and a still don't get a clue about what to do!

I'm brazilian, and because of it, i got to translate my games to my language (portuguese), but there's a problem, my language got some accents like "é á ç ô" (i don't know if you guys can see it..)

There's the things I already tried:

- change the encoding of my source to Portuguese (Codepage 860) didn't work..
- change the encoding of my source to UTF-8 didn't work..
- use the ALLEGRO_USTR* and it didn't work eather...

I'm really lost, can sameone help me?

That's my code:

#SelectExpand
1 #include <allegro5\allegro.h> 2#include <allegro5\allegro_image.h> 3#include <allegro5\allegro_font.h> 4#include <allegro5\allegro_ttf.h> 5#include <sstream> 6#include <iostream> 7//#include <locale.h> 8 9using namespace std; 10 11int main(){ 12 //setlocale(LC_ALL,""); 13 14 ALLEGRO_DISPLAY *display = NULL; 15 ALLEGRO_BITMAP *image = NULL; 16 ALLEGRO_USTR *stringStranger = NULL; 17 ALLEGRO_FONT *font_30 = NULL; 18 ALLEGRO_FONT *font_40 = NULL; 19 20 21 stringstream dude; 22 stringstream answer1; 23 stringstream answer2; 24 stringstream answer3; 25 stringstream answer4; 26 int contDisplay = 1; 27 dude << "Olá sir, how are you?"; 28 answer1 << "answer um"; 29 answer2 << "answer dois"; 30 answer3 << "answer tres"; 31 answer4 << "answer uatro"; 32 33 34 35 //program init 36 if(!al_init()) 37 return -1; //initialize Allegro 38 39 al_init_image_addon(); 40 al_init_font_addon(); 41 al_init_ttf_addon(); 42 43 font_30 = al_load_ttf_font("Arial.ttf", 50, 0); 44 45 46 display = al_create_display(640, 400); 47 if(!display) 48 return -1; //test display DUUUUUDE 49 50 51 al_draw_ustr(font_30, al_map_rgb(255,255,255), 0, 0, NULL, al_ustr_new("Oiaeáá")); 52 al_draw_text(font_30, al_map_rgb(255,255,255), 0, 100, 0, "Olá señor"); 53 al_flip_display(); 54 55 56 57 58 59 60 system("pause"); 61 al_destroy_display(display); 62 63 64 65 cout << dude.str(); 66 67 68}

Thank you very mutch guys!

Elias
Member #358
May 2000

change the encoding of my source to UTF-8 didn't work..

Try doing it in another editor. If nothing else helps, load the strings from a text file encoded in UTF-8.

--
"Either help out or stop whining" - Evert

Bruno Guerra
Member #15,337
October 2013

I'm using Microsoft Visual Studio 2012, I need to use it because i'm gonna embed Windows Forms to it... How can I do that? :(

Nidrax
Member #14,485
August 2012
avatar

Open the file with a software called Notepad++. Then go to Encoding menu and Choose converting to UTF-8 without BOM. VS should keep that coding in later work.

Oh, and please note, that non-ANSI characters will most probably not show in the windows command prompt (cmd.exe) no matter how much you try unless you change the font or use some character translation algorythm (I guess I use something like this to get Polish chars like ąęóćśźż, but I do not remember the code now), but it should work just fine in-game.

Aikei_c
Member #14,871
January 2013
avatar

That's pretty strange that changing encoding didn't help you. How did you do that? You're probably doing it wrong. You should go to file->advanced save options and choose Unicode (UTF-8 Without Signature) - Codepage 65001, it is at the end of the list. Did you choose this encoding?

Bruno Guerra
Member #15,337
October 2013

You guys are right, I was doing it wrong :(

I changed on Notepad++ to without signature and it work!

Thank you very mutch for the help!

Gabriel Campos
Member #12,034
June 2010
avatar

Welcome Bruno Guerra. I'm from Brazil too. This forum is awesome. If you dont find the solution to your problems here, will not find in any place! ;D

Arthur Kalliokoski
Second in Command
February 2005
avatar

If you dont find the solution to your problems here, will not find in any place!

Always excepting girl friends, of course. :P

They all watch too much MSNBC... they get ideas.

Go to: