Is it possible to integrate special international characters like the German Umlauts ö ä ü or French accents é â, etc. into the SMAUG engine ?
I'm fiddling around with the code, translating some of it (including commands) into different languages.
Now Commands that have Umlauts in them don't work, nor does the display of Accents or Umlauts in the different clients.
Is there some easy workaround maybe?
I'm using VC++ and the SMAUG source from this site.
Thanks for any answers.
Cheers,
fog
Can you give an example line which you have tried, and doesn't work? Also, which client are you using to view it?
You can test the reception of such codes in MUSHclient, by pressing Shift+Ctrl+F12 and then typing the text and hitting OK.
This is what I got ...
The prompt was already there. You can see it worked fine at the client end.
Thanks for the fast answers, and sorry for the bad explanation. I'll try to give a more concrete one.
If I just type ä ü or something in the client, it is displayed.
Only Umlauts that I send through the engine won't work.
Like:
Say ä ö
Gives:
Say what ?
Like:
Say Hellö
Gives:
You say 'Hell'
If I call a mob:
"Schäferhund"
which is German for "shepherd dog"
You can't examine it, but I think this is because the ä is stripped when the user types 'exam Schäferhund'.
This is just one part of the international character problem, I'll try to rephrase the question tomorrow, when I'm not so tired, 4am here at the moment. :)
You can fix this quite easily. There is a test in comm.c which can be changed.
In comm.c, around line 1275 there is this code, that filters out nonprintable and non-ascii characters:
if ( d->inbuf[i] == '\b' && k > 0 )
--k;
else if ( isascii(d->inbuf[i]) && isprint(d->inbuf[i]) )
d->incomm[k++] = d->inbuf[i];
Change it to read ...
if ( d->inbuf[i] == '\b' && k > 0 )
--k;
else if ( (unsigned char) d->inbuf[i] >= ' ' )
d->incomm[k++] = d->inbuf[i];
This merely filters out control characters (less than a space). I tested it and it seems to work OK:
Say Hellö - I see a Schäferhund
You say 'Hellö - I see a Schäferhund'
Amended on Tue 04 Mar 2003 03:31 AM by Nick Gammon
Yes, I'm still awake. ;)
I tried your change, but I could not even log into the MUD anymore, as passwords were stripped or something, and thus reported as incorrect.
New player couldn't be created too: 'Passwords do not match' at the re-type.
But it pointed me to the good place, as this didn't work for me, I tried a walkaround. I think it basically does what your change does.
Add a new define in mud.h
#define int_print(x) ( ((unsigned char)x >= 32) && ((unsigned char)x <= 250))
After that I exchanged the isascii with int_print and got rid of the isprint part of the if clause you mentioned.
Works fine for my as of yet, all umlauts and accents work, but the question remains, is this a good fix?
What do you think, can I keep it like this?
My fix should have worked, maybe your code was different to start with, or you omitted a line somehow.
Anyway, your solutions sounds OK, and if it works, well and good.
Are you sure you want to omit 251 to 254? Isn't ü a 252?