Page 1 of 1

SendSysMessage, Print and other methods... how charset...

Posted: Tue Feb 11, 2014 9:28 pm
by Nsuidara
Hello.

My question is how can i use UTF-8 in
SendSysMessage or Gumps...

i need charset ź ę ł ó ą ż ...

Re: SendSysMessage, Print and other methods... how charset..

Posted: Wed Feb 12, 2014 1:46 am
by Yukiko
I am not familiar with UTF-8 but is that the same as Unicode? I think you would use the unicode.em module for SendSysMessage etc. but I don't know about gumps. Here is the link to the docs section that lists the functions in that module. I apologize if I am incorrect but as I said I am not familiar with UTF-8 or Unicode I/O.

Re: SendSysMessage, Print and other methods... how charset..

Posted: Wed Feb 12, 2014 6:41 am
by Nsuidara
Yes i know... exist module but dont work...

Re: SendSysMessage, Print and other methods... how charset..

Posted: Thu Feb 13, 2014 12:49 am
by Zik
This ucod include is for Russian unicode, but you can change it to letters you need, and change langcode to your's:
langcode := "RUS"

In UO.EM comment these lines:
//Broadcast( text, font := _DEFAULT_TEXT_FONT, color := _DEFAULT_TEXT_COLOR );
//PrintTextAbove( above_object, text, font := _DEFAULT_TEXT_FONT, color := _DEFAULT_TEXT_COLOR, journal_print := JOURNAL_PRINT_NAME );
//SendSysMessage( character, text, font := _DEFAULT_TEXT_FONT, color := _DEFAULT_TEXT_COLOR );

Don't know if it'll work with basic.em::Print()
I don't see russian letters correctly in a console window. But I never tried to do anything with it.

In scripts you have to add:
use unicode;
include "include/ucod";

and usage will be simple like:
SendSysMessage(who,"Добавлено "+ochk+" очков",3,COLOR_GREEN);

***********

As for the gumps text entries and text input, you'll need to use packethook.
You'll need to change this function:

Code: Select all

function UnicodeParser(byref uniarr)
var i;
for(i := 1; i<=uniarr.size();i+=1)
if(uniarr[i] > 1024)
	uniarr[i]-=848;
endif
endfor
endfunction
Russian letters in UO's fonts.mul start from 176 (1024-848=176).
We changed fonts.mul letter's in some basic fonts, check it with UOFiddler.

And in your client's uo.cfg add:
UnicodeSpeech=on

Hope it'll help you.