[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Adding international special characters to the code.

Adding international special characters to the code.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Fogwraith   (5 posts)  [Biography] bio
Date Mon 03 Mar 2003 11:58 PM (UTC)
Message
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
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 04 Mar 2003 02:30 AM (UTC)
Message
Can you give an example line which you have tried, and doesn't work? Also, which client are you using to view it?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Tue 04 Mar 2003 02:32 AM (UTC)
Message
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 ...


<887hp 100m 750mv> ö ä ü



The prompt was already there. You can see it worked fine at the client end.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fogwraith   (5 posts)  [Biography] bio
Date Reply #3 on Tue 04 Mar 2003 03:16 AM (UTC)
Message
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. :)
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Tue 04 Mar 2003 03:29 AM (UTC)

Amended on Tue 04 Mar 2003 03:31 AM (UTC) by Nick Gammon

Message
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'

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fogwraith   (5 posts)  [Biography] bio
Date Reply #5 on Tue 04 Mar 2003 05:14 AM (UTC)
Message
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?
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Tue 04 Mar 2003 06:24 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Tue 04 Mar 2003 06:31 AM (UTC)
Message
Are you sure you want to omit 251 to 254? Isn't ü a 252?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,124 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]