When I use a ü or ö in the file it will not be displayed on my psp. I use Intrafont with the oslib and UTF-8 encoding. Do you have an idea how to fix this ?
Advertising
we don't read minds. more clues are needed.failbit wrote:Hello I have a little problem with the oslib. I added a multi-language support to my game Mobile Skat. The languages are read out from a file. All works good except the german translation.
When I use a ü or ö in the file it will not be displayed on my psp. I use Intrafont with the oslib and UTF-8 encoding. Do you have an idea how to fix this ?
Code: Select all
oslInit(OSL_IF_USEOWNCALLBACKS);
oslInitGfx(OSL_PF_8888, 1);
oslInitAudio();
oslIntraFontInit(INTRAFONT_CACHE_ALL | INTRAFONT_STRING_UTF8);
ltn0 = oslLoadFontFile("flash0:/font/ltn0.pgf");
oslIntraFontSetStyle(ltn0, 1.0f,WHITE,BLACK,INTRAFONT_ALIGN_CENTER);
oslSetFont(ltn0);
Code: Select all
int open_lang_file(char path[])
{
int v = 0;
FILE* f = fopen(path, "r");
if(f == 0)
{
show_message_dialog("Can't open language-file!",0);
return 0;
}
char line[50];
while(fgets(line, 50, f))
{
if(line[0] != 0)
{
sprintf(languagestr[v], "%s",line);
}
else
{
char message[50];
sprintf(message, "Error while reading language packages at %d!",v);
show_message_dialog(message, 0);
return 0;
}
v++;
}
fclose(f);
return 1;
}
Code: Select all
oslStartDrawing();
oslIntraFontSetStyle(ltn0, 1.2f,WHITE,BLACK,INTRAFONT_ALIGN_CENTER);
oslDrawStringf(240, 20, languagestr[1]);
oslEndDrawing();
oslEndFrame();
oslSyncFrame();
Code: Select all
oslLoadFontFile("flash0:/font/ltn0.pgf");
Dont forget the ß umlautfailbit wrote:Hello I have a little problem with the oslib. I added a multi-language support to my game Mobile Skat. The languages are read out from a file. All works good except the german translation.
When I use a ü or ö in the file it will not be displayed on my psp. I use Intrafont with the oslib and UTF-8 encoding. Do you have an idea how to fix this ?
Then perhaps your text file isn't really UTF-8? Try loading it with firefox and set character encoding to UTF-8 to verify. Does all characters show up correctly?failbit wrote:I changed the font to ltn1 and then to ltn15 but the word "Menü" is still "Men" in the game.
the compiler translate string literals before saving them, so this happens compile-time and not run-time.I use now ltn8.pgf like in the intrafontsample in psp-sdk. When i write it as hexadezimal(e.g \xC3\xA5) and pass it directly to oslDrawString then an ""a" with a circle on top" is printed on screen. But when I try the same by loading \xC3\xA5 from a file it gives me \xC3\xA5 and not ""a" with a circle on top".